Jump to content

PHP time offset


dpt321

Recommended Posts

Hi all,

I have inherited a php script that I am hosting on a US server but am trying to get it to work using Australian timezones (its a booking script).

BEfore you ask, changing the timezone of the server is unfortunately not an option.

I have narrowed the problem code down to the below, adding the below to the top of the script

date_default_timezone_set('Australia/ACT');

gets the display part working but when they submit times for booking based on the

$dtDate

variable, it is submitted based on server time.

 

Any ideas?

<? session_start();
date_default_timezone_set('Australia/ACT');
require 'common.php';

$dtDate = date("Y-m-d", mktime(0, 0, 0, date("m")  , date("d")+$_SESSION[OFFSET], date("Y")));

?>

Link to comment
https://forums.phpfreaks.com/topic/206733-php-time-offset/
Share on other sites

Yes, but you did not provide any information in your post as to what result you ARE getting vs what you expect.

 

For all we can tell, you are then storing this information in a database and using DB query functions that are using the database's timezone setting and not matching the correct information.

Link to comment
https://forums.phpfreaks.com/topic/206733-php-time-offset/#findComment-1081155
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.