phplist

NOTE:: Before reporting an issue, make sure you are running the latest version, currently 3.3.1


View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016919phplist applicationMessage Managementpublic15-10-13 09:2502-04-15 13:59
Reporterlwc 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.0.5 
Target VersionFutureDevelopmentsFixed in Versionplugin Development 
Summary0016919: Configurable timezone offset
DescriptionAs mentioned in #5331 and in several forum topics, it's time for an official request to allow configuring a timezone.
Additional Informationhttp://forums.phplist.com/search.php?keywords=timezone&sf=titleonly&sr=topics [^]
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0052353)
michiel (manager)
15-10-13 11:59

check out the "config_extended.php" :

# Time Zone
# By default phpList will operate in the Timezone of your server. If you want to work
# in a different Timezone, you can set that here. It will need to be a valid setting for
# both PHP and Mysql. The value should be a city in the world
# to find PHP timezones, check out http://php.net/manual/en/timezones.php [^]
# You will also need to tell Mysql about your timezones, which means you have to load the timezone
# data in the Mysql Database, which you can find out about here:
# http://dev.mysql.com/doc/refman/5.0/en/mysql-tzinfo-to-sql.html [^]
# make sure that the value you use works for both PHP and Mysql. If you find strange discrepancies
# in the dates and times used in phpList, you probably used the wrong value.

# define('SYSTEM_TIMEZONE','Europe/London');


although, some feedback on this may be useful
(0052354)
lwc (reporter)
15-10-13 18:02
edited on: 15-10-13 18:06

Wasn't aware of this v3 setting, I take my hat off for you!
But I see some problems with this approach:
1) Not everyone have the needed permissions for the MySQL change.
2) It won't just affect phpList but other tables as well, if such exist.
3) It's a very specific hack for MySQL. It won't work with other databases.
4) If you have MySQL, but for some reason would ever need to replace timezones, it would create a major headache because you already saved them in the previously local timezone.

But I'll tell you what, I also have a solution, which I will supply in the following note.

(0052355)
lwc (reporter)
15-10-13 18:03
edited on: 15-10-13 18:07

I have an idea for a solution that will let PHP do all the work and thus be database independent and let you change timezones on the fly:
1) Assign a PHP timezone in the main script.
2) When you save times into the database, store the times in UTC/GMT+0.
3) When you restore times from the database, transition them into local times.

In other words:

// Main script

if (defined('SYSTEM_TIMEZONE'))
    ini_set('date.timezone', SYSTEM_TIMEZONE);

// Store the resulting time into the database
function time_for_database($time='') {
  if (empty($time))
    $time = time();
  if (defined('SYSTEM_TIMEZONE'))
     $time -= (int)substr(date('O'),0,3)*60*60;
  return $time;
}

// When reading a time from the database
function time_from_database($database_time) {
  if (defined('SYSTEM_TIMEZONE'))
      $database_time += (int)substr(date('O'),0,3)*60*60;
  return $database_time;
}

(0052358)
michiel (manager)
16-10-13 03:12

yes, that's another option. Except it will require quite a lot more changes in the code, and is therefore more likely to start causing bugs (or often called undocumented features :-)

Still it can be good to look into it. For the time being timezone settings are for powerusers only.
(0055998)
gingerling (administrator)
31-03-15 10:53

where are we at with this? Just documenting scheduling and want to know what to say.... I know we have the feature in hosted, has that changed the situation for download at all?
(0056001)
michiel (manager)
02-04-15 13:59

you can use https://resources.phplist.com/plugin/timezone [^]


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker