182x Posted July 13, 2007 Share Posted July 13, 2007 Hey guys, I am using the following to display the date/time for the user, however I was wondering is there a way to automate the process of the daylight saving time so that the code does not have to be changed everytime the time changes? Thanks. <?php date_default_timezone_set('GMT+1');echo date('l dS \of F Y h:i:s A'); ?> Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/ Share on other sites More sharing options...
lococobra Posted July 14, 2007 Share Posted July 14, 2007 Find the month/day using separate date() calls, then use ifs to check if the date is within a DST time zone, if so... adjust the time accordingly and finally build the echo'd string out of a couple other date() calls concatenated with the time stuff you've found. Hmm, complicated enough? Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-297869 Share on other sites More sharing options...
182x Posted July 14, 2007 Author Share Posted July 14, 2007 thanks for teh reply when I upload the code to the server I now get thie following error, just wondering how to avoid it? Call to undefined function: date_default_timezone_set() Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-298336 Share on other sites More sharing options...
metrostars Posted July 14, 2007 Share Posted July 14, 2007 NVM. Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-298337 Share on other sites More sharing options...
182x Posted July 14, 2007 Author Share Posted July 14, 2007 thanks but with that i get this error: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-298339 Share on other sites More sharing options...
182x Posted July 14, 2007 Author Share Posted July 14, 2007 nevermind. Anymore ideas? Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-298340 Share on other sites More sharing options...
metrostars Posted July 14, 2007 Share Posted July 14, 2007 What version of phP u using? Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-298341 Share on other sites More sharing options...
182x Posted July 14, 2007 Author Share Posted July 14, 2007 5 Link to comment https://forums.phpfreaks.com/topic/59886-php-datetime-function/#findComment-298356 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.