note 92381 added to function.date-format

From: Date: Wed, 22 Jul 2009 10:52:33 +0000
Subject: note 92381 added to function.date-format
Groups: php.notes 
Request: Send a blank email to php-notes+get-158571@lists.php.net to get a copy of this message
Requirements: PHP5+ To expand on Matt Walsh's example, a simple way to get eBay, or Amazon, web service timestamps is as follows: <?php $current_time = urlEncode(subStr(date("c"), 0, 19)."Z"); ?> In other words, take the date/time of now (in ISO 8601 format), discard the trailing Daylight Savings Time specifier, add a "Z" where the DST was and urlEncode the whole thing to convert the time's colons for REST requests (required for amazon, not sure about eBay). Another way might be to create your own timestamp: <?php $current_time = urlEncode(date("Y-m-d")."T".date("H:i:s")."Z"); ?> This way however takes a little more coding on the line. As far as performance goes, I'm not sure which may be quicker. I just like things to work and work well, don't much care for how fast they are as long as they get the job done :) Enjoy! ---- Server IP: 209.41.74.194 Probable Submitter: 213.105.48.179 ---- Manual Page -- http://www.php.net/manual/en/function.date-format.php Edit -- https://master.php.net/note/edit/92381 Del: integrated -- https://master.php.net/note/delete/92381/integrated Del: useless -- https://master.php.net/note/delete/92381/useless Del: bad code -- https://master.php.net/note/delete/92381/bad+code Del: spam -- https://master.php.net/note/delete/92381/spam Del: non-english -- https://master.php.net/note/delete/92381/non-english Del: in docs -- https://master.php.net/note/delete/92381/in+docs Del: other reasons-- https://master.php.net/note/delete/92381 Reject -- https://master.php.net/note/reject/92381 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158571) next »