You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve been using “2017-03-14 00:00:00” format for a long time, Im not entirely sure why TBH, perhaps because it contains everything you need in a condensed format?
I usually convert Unix time stamp to this format with:
$datestr = date("Y-m-d H:i:s",time());
luckily php’s strtotime converts a large variety of time formats back to unix time :slight_smile: I dont really have a strong opinion on this either way
The problem, as seen, is that this is ambiguous in that there is no indication of the timezone and could easily be interpreted as local time by an external processor (which in the absence of a timezone many will do). If the data was fed back in, would strtotime assume it was local rather than UTC? Just tested it and strtotime doesn't actually like this format.
I'd prefer:
$datestr = date(DATE_ISO8601);
Or even make the format user configurable 😄 That would of course help anyone who wants it in the current format.
Activity
borpin commentedon Jul 17, 2018
The problem, as seen, is that this is ambiguous in that there is no indication of the timezone and could easily be interpreted as local time by an external processor (which in the absence of a timezone many will do). If the data was fed back in, would
strtotimeassume it was local rather than UTC? Just tested it andstrtotimedoesn't actually like this format.I'd prefer:
$datestr = date(DATE_ISO8601);
Or even make the format user configurable 😄 That would of course help anyone who wants it in the current format.