note 39103 added to function.date

From: Date: Sat, 17 Jan 2004 03:52:42 +0000
Subject: note 39103 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-63717@lists.php.net to get a copy of this message
If you want to return a W3 preferred date and time (W3CDTF documentation available at http://www.w3.org/TR/NOTE-datetime) you can use the following: <?php echo substr(date("Y-m-d\Th:i:sO"),0,22).":".substr(date("O"),3); ?> I don't know how the internals of PHP work when a script executes, but the following may present a caveat: If the script is run very very close to the stroke of midnight, and the first date function returns something along the lines of 2004-01-17T23:59:59+11:00 and the second one returns +10:00 during the change from daylight savings to normal time. The result, the timezone offset may appear one hour out. The likelihood is extremely rare (twice a year if you include the reverse occurring), and timing would need to be executed very carefully to reproduce this effect. You would also need a very very slow system to notice the effect. ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39103 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39103&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39103&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63717) next »