Jump to content

Recommended Posts

Hello,

 

I have a question about datetime. In my website, i have member from canada, usa, france, sweden, belgium..... and a lot of other country

 

Until now, i setup my server for the time GMT, so every date was save at the time of GTM, so every message, profile modification date were always save with that date.

In my code: i did:

$mDate = new DateTime($profile["DerniereVisite"]);
if(!isset($_SESSION["uTimeZome"])) 
 $_SESSION["uTimeZome"]="UTC";

if($_SESSION["uTimeZome"]!="UTC")[b]{ [/b]				
 $tz = new DateTimeZone($_SESSION["uTimeZome"]);
 $mDate->setTimezone($tz);[b]}[/b]


  $DerniereVisite = formatTExtDate($mDate->format('Y-m-d  G:i:s'));

so the $_SESSION["uTimeZome"] keep the good time zone for php for this members, depending on with country he or she is

 

So, with all the test i did, my way works.

 

But now, i change my server for a better server with another compagny.

 

Today, i realize that my server has the localsetting, i mean the server has the date and time for Canada(québec).

So i realize that there are some date, that are not converted correctly for some user in other country.

 

So i ask to the administrator for the server to change it to GMT!

 

But his answer was, it's not good to change datetime zone for a server...... that my way to do this is probably wrong and i should check my code...... after some discussion, they finish to change de timezone as i asked.

 

 

But my question, do i use a good way or a bad way?

 

thanks a lot!

 

Pascal

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.