(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTime::setTimestamp -- date_timestamp_set — Sets the date and time based on an Unix timestamp
Object-oriented style
Procedural style
Sets the date and time based on an Unix timestamp.
Like DateTimeImmutable::setTimestamp() but works with DateTime.
The procedural version takes the DateTime object as its first argument.
object
Procedural style only: A DateTime object returned by date_create(). The function modifies this object.
timestamp
Unix timestamp representing the date.
Setting timestamps outside the range of int is possible by using
DateTimeImmutable::modify() with the @
format.
Returns the modified DateTime object for method chaining.
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant