According to the documentation JFactory/getDate $tzOffset
default value is 0
. However, the following example:
$date_default_offset = JFactory::getDate('now');
echo $date_default_offset->toRFC822(true);
echo "<br />";
$date_zero_offset = JFactory::getDate('now', 0);
echo $date_zero_offset->toRFC822(true);
... gives different outputs:
Mon, 13 Oct 2014 18:31:37 +0000
Mon, 13 Oct 2014 19:31:41 +0100
Shouldn't both dates be the same? What else should I take into account?
The actual date is:
echo date("r"); // Mon, 13 Oct 2014 20:40:33 +0200
That's right because the server is in Spain (+1 GMT and +1 Daylight Saving Time in Summer).
The problem arised whe trying to adjust a module to take into account the current time in Canary Islands, that should be Mon, 13 Oct 2014 19:31:41 +0100
according to the given example.
I'm using Joomla! 2.5.27, the Server Time Zone is set to Canary (GMT+0).
echo JHtml::date('now', 'Y-d-m H:i:s e', 'Atlantic/Canary');
?