Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.