Jump to content

php date/time function


182x

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.