Project

General

Profile

Bug #1017

Timezone issues

Added by Anonymous almost 10 years ago. Updated almost 9 years ago.

Status:
Bug resolved
Priority:
Normal
Target version:
Start date:
16/04/2010
Due date:
% Done:

0%

Estimated time:
Complexity:
Difficult

Description

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
Output:
  • 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.

History

#1

Updated by Anonymous almost 10 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.

#2

Updated by Sven Vanpoucke almost 10 years ago

  • Category set to 21
  • Target version set to 2
#4

Updated by Sven Vanpoucke almost 10 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.

#5

Updated by Sven Vanpoucke almost 10 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);

#6

Updated by Stefaan Vanbillemont almost 9 years ago

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

Updated by Stefaan Vanbillemont almost 9 years ago

  • Target version changed from 2 to 1.0.0

Also available in: Atom PDF