note 43921 modified in function.gmdate by danbrown

From: Date: Sun, 20 Jul 2008 03:14:51 +0000
Subject: note 43921 modified in function.gmdate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142038@lists.php.net to get a copy of this message
Wath out for summer time and winter time... If you want to get the current date and time based on GMT you could use this : <?php $timezone = -5; //(GMT -5:00) EST (U.S. & Canada) echo gmdate("Y/m/j H:i:s", time() + 3600*($timezone+date("I"))); ?> this would gives: 2004/07/8 14:35:19 in summer time and 2004/07/8 13:35:19 in winter time. Note that date("I") returns 1 in summer and 0 in winter. --was-- Wath out for summer time and winter time... If you want to get the current date and time based on GMT you could use this : $timezone = -5; //(GMT -5:00) EST (U.S. & Canada) echo gmdate("Y/m/j H:i:s", time() + 3600*($timezone+date("I"))); this would gives: 2004/07/8 14:35:19 in summer time and 2004/07/8 13:35:19 in winter time. Note that date("I") returns 1 in summer and 0 in winter. http://php.net/manual/en/function.gmdate.php

« previous php.notes (#142038) next »