Bug #1017

Timezone issues

Added by Anonymous almost 13 years ago. Updated almost 12 years ago.

Bug resolved
Sven Vanpoucke
Target version:
Start date:
Due date:
% Done:


Estimated time:


Steps to reproduce:
  1. Upload a file in your repository
  2. Look at the modified time: it is displayed in your current timezone
  3. Go into My account > Account settings and change your timezone
  4. Go back to my repository
  • The modified time of the file is displayed in the previous timezone of the user
Expected output:
  • The modified time should be displayed in the current timezone of the user

In other words, every datetime should be stored as UTC in the database and then converted in the user's timezone before being displayed.



Updated by Anonymous almost 13 years ago

To get the current time in UTC, you can use gmdate.

To convert dates and times to different timezones, use the DateTime and DateTimezone php classes.


Updated by Sven Vanpoucke almost 13 years ago

  • Category set to 21
  • Target version set to 2

Updated by Sven Vanpoucke almost 13 years ago

  • Assignee set to Sven Vanpoucke

Updated by Sven Vanpoucke almost 13 years ago

  • Status changed from New to Assigned

After many hours of experimenting with several things i've noticed that the easiest solution is the following
We save everything in UNIX TIME STAMP in the database, which basically is always in GMT. When loading the platform, the user's default timezone is selected by date_default_timezone_set. Because a unix timestamp isn't readable for the end users it has to be formatted with time / date functions. Because we use timestamps and we set the default timezone, the timestamp will always be converted to the correct timezone without much problems.


Updated by Sven Vanpoucke over 12 years ago

  • Status changed from Assigned to Bug resolved

I have changed every timestamp to unix integer time. It is now very easy to convert it to different timezones. It could be that there is still a timestamp that is not correctly formatted into the system and looks like a number. Just let me or hans know. You can also try to fix it yourself by using DatetimeUtilities :: format_locale_date(null, $time);


Updated by Stefaan Vanbillemont almost 12 years ago

  • Project changed from Chamilo LCMS Connect to Common
  • Category deleted (21)

Updated by Stefaan Vanbillemont almost 12 years ago

  • Target version changed from 2 to 1.0.0

Also available in: Atom PDF