views:

914

answers:

3

I know this might sound a silly question, but I did not find in PHP documentation somewhere were they state loud and clear this one.

I have got a web application.

Users of my web appliations are in Europe, but the server running the web appliation is in US.

How should I set the date.timezone php ini directive???

I suppose to where the server is located so if it's in New York: date.timezone = "America/New_York"

But am I right?

+1  A: 

I think that it's better to set server's local timezone or UTC and change user timezone in script using http://pl.php.net/manual/en/function.date-default-timezone-set.php You can set timezone to Europe/sth or compute it for each client using GeoIP or JavaScript (it should be possible)

skyman
A: 

According to what I read here around on SO the answers is:

  1. set PHP date.timezone ini directive to "UTC" (i.e. 0)
  2. let PHP print in pages the date time (UTC) as a simple Unix time stamp (a number)
  3. let Javacscript transform the UTC Unix time stamp in client time by simply doing:

    new Date(<?php echo DATE_TIME_SERVER_UTC; ?> * 1000);

Marco Demajo