Changeset a621a9d in github
- Timestamp:
- Mar 14, 2012 5:33:05 PM (15 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
- Children:
- b9ce92d
- Parents:
- 6699a68
- File:
-
- 1 edited
-
program/include/main.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/main.inc
r8f77c03 ra621a9d 726 726 * This uses the date formatting properties from config 727 727 * 728 * @param mixed Date representation (string or timestamp)728 * @param mixed Date representation (string, timestamp or DateTime object) 729 729 * @param string Date format to use 730 730 * @param bool Enables date convertion according to user timezone … … 736 736 global $RCMAIL, $CONFIG; 737 737 738 if (!empty($date)) 739 $ts = rcube_strtotime($date); 740 741 if (empty($ts)) 742 return ''; 743 744 try { 745 $date = new DateTime("@".$ts); 746 } 747 catch (Exception $e) { 748 return ''; 738 if (is_a($date, 'DateTime')) { 739 $ts = $date->format('U'); 740 $tzs = $date->getTimezone(); 741 } 742 else { 743 $tzs = 'GMT'; 744 745 if (!empty($date)) 746 $ts = rcube_strtotime($date); 747 748 if (empty($ts)) 749 return ''; 750 751 try { 752 $date = new DateTime("@".$ts); 753 } 754 catch (Exception $e) { 755 return ''; 756 } 749 757 } 750 758 … … 752 760 // convert to the right timezone 753 761 $stz = date_default_timezone_get(); 754 $tz = new DateTimeZone($convert ? $RCMAIL->config->get('timezone') : 'GMT');762 $tz = new DateTimeZone($convert ? $RCMAIL->config->get('timezone') : $tzs); 755 763 $date->setTimezone($tz); 756 764 date_default_timezone_set($tz->getName());
Note: See TracChangeset
for help on using the changeset viewer.
