Jump to content

Make Script Return Time in Central Time


smy101

Recommended Posts

SO I have a script with the following line of code:

 

date("F j, Y, g:i a");

 

Which returns the time like:  "March 16, 2007, 12:25 pm"

 

The problem is that is in Eastern time (presumably where my server is) and I need it to return in Central time.

 

Can someone tell me what I need to modify to get that to return Central time?

 

Thanks in advance!

 

Link to comment
https://forums.phpfreaks.com/topic/43006-make-script-return-time-in-central-time/
Share on other sites

$offset = 2; // + 2 hours
$offset = -2; // -2 hours
date("F j, Y, g:i a", time()+60*$offset);

 

Thanks!  That didn't work as written, but I modified it slightly and it works perfect now.  The "$offset" time was subtracting minutes rather than hours so I had to modify it as follows:

$offset = -60; // -60 minutes;
date("F j, Y, g:i a", time()+60*$offset);

 

That subtracted exactly 1 hour off the time so its all good now.  Thanks for the help.

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.