See Also

User Contributed Notes 4 notes

It should be noted above, be careful when manipulating the DateTime object with unix timestamps.In the above examples you will get varying results dependent on your current timezone, method used, and version of PHP.

One would expect all of the examples above to perform the same as setTimestamp() or date('H:i', $timestamp); would.

When the exact time is important then it is important to note the difference between this and the UnixTimeStamp. The function will change the timestamp if necessary to take into account the daylight savings time.e.g. Working with the 'Europe/London' timezone and setting the DateTime object to a timestamp of 1288486753 will result in the function automatically altering it to 1288490353.This is because it is taking the fall time instead of the summer time (they will both be Sun, 31-Oct-2010 01:X:Y (I didn't check the hour and minute)).Sincerely,Aouie