note 109773 added to function.date

From: Date: Sun, 19 Aug 2012 04:46:31 +0000
Subject: note 109773 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-190132@lists.php.net to get a copy of this message
Use this to convert the local/UTC hour to the UTC/local hour: <?php for($utc_to_local = array(), $offset = date('Z'), $h = 0; $h < 24; $utc_to_local[] = date('G', mktime($h++)+$offset)); $local_to_utc = array_flip($utc_to_local); echo "2 am local is ", $local_to_utc[2], " UTC"; echo "3 pm UTC is ", $utc_to_local[15], " local"; ?> This is useful when you need to do many conversions. Lookup tables are faster than calling date() and mktime() multiple times. ---- Server IP: 69.147.83.197 Probable Submitter: 142.196.10.3 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/109773 Del: integrated -- https://master.php.net/note/delete/109773/integrated Del: useless -- https://master.php.net/note/delete/109773/useless Del: bad code -- https://master.php.net/note/delete/109773/bad+code Del: spam -- https://master.php.net/note/delete/109773/spam Del: non-english -- https://master.php.net/note/delete/109773/non-english Del: in docs -- https://master.php.net/note/delete/109773/in+docs Del: other reasons-- https://master.php.net/note/delete/109773 Reject -- https://master.php.net/note/reject/109773 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#190132) next »