[wp-trac] [WordPress Trac] #35458: current_date returns incorrect timestamp
WordPress Trac
noreply at wordpress.org
Thu Jan 14 15:32:24 UTC 2016
#35458: current_date returns incorrect timestamp
----------------------------+-----------------------------
Reporter: Turn On Social | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
'timestamp' functionality appears to be wrong.
current_time('timestamp') should always return the timestamp according to
UTC. That's because a timestamp is defined as the number of seconds that
have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1
January 1970.
Therefore, producing this offset by x number of hours for local time is
incorrect logic. If it's 1,452,598,896 seconds since the start of Unix
time, this does not change depending on timezone - the number of seconds
is the same (but may instead be displayed differently depending on
timezone).
John mentioned this was so it could be used in date functions but when an
incorrect timestamp is fed to a date function, it will display the date
wrong (as the timestamp has been artificially manipulated).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35458>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list