note 57441 added to function.gmstrftime

From: Date: Tue, 04 Oct 2005 12:53:46 +0000
Subject: note 57441 added to function.gmstrftime
Groups: php.notes 
Request: Send a blank email to php-notes+get-96342@lists.php.net to get a copy of this message
Dear all, I feel so confuse about the Date & Time function in PHP, and I don't know what the BEST way to get a GMT timestamp in PHP. Here are the testing data from my server (Windows Server 2003, IIS 6, PHP 4, GMT+08:00), and I try to find a GMT timestamp for my application. // this is server time with timezone info date("r") = Tue, 4 Oct 2005 21:21:58 +0800 // this it server time too date("Y-m-d H:i:s T(O)") = 2005-10-04 21:21:58 China Standard Time(+0800) // use mktime() to get the timestamp, but it is a GMT timestamp??? I try to convert it using javaScript: Tue, 4 Oct 2005 13:21:58 UTC mktime() = 1128432118 // this is gmdate gmdate("Y-m-d H:i:s (O)") = 2005-10-04 13:21:58 (+0000) // this is gmmktime, but it is Tue, 4 Oct 2005 21:21:58 UTC gmmktime() = 1128460918 Or I disunderstood the difference between mktime() and gmmktime()? Or mktime() is return GMT but gmmktime() return timezone's time? In short, what the function or way to get a GMT time that no need concern the server's timezone setting? ---- Manual Page -- http://www.php.net/manual/en/function.gmstrftime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57441 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57441&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57441&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#96342) next »