0

I've come across a deprecated statement in a piece of code;

$this->_dateTimeZone = new \DateTimeZone($timezone);
$this->_dateFormatter->setTimeZoneId($timezone);

Gives
Deprecated: IntlDateFormatter::setTimeZoneId(): Use datefmt_set_timezone() instead, which also accepts a plain time zone identifier and for which this function is now an alias

I thought, OK, I'll just switch to the suggested way of setting the time-zone so I tried:

$this->_dateTimeZone = new \DateTimeZone($timezone);
datefmt_set_timezone($timezone);

Gives
Warning: datefmt_set_timezone() expects exactly 2 parameters, 1 given in ...

I tried searching the manual for this function here but the function is not listed anywhere.

My question is; what 2 parameters are required? I can't seem to find anything related to the given function - though it clearly exists in the later versions of PHP.

Daniel
  • 3,726
  • 4
  • 26
  • 49
  • 2
    How about this one? http://www.php.net/manual/en/intldateformatter.settimezone.php – ToBe May 22 '14 at 09:40
  • @ToBe; Seems to be working. Strange that the suggested function does not exist in the manual though. – Daniel May 22 '14 at 09:50
  • Probably something very new. It's listed as a procedural synonym on that page, but not it's mystical second parameter. – ToBe May 22 '14 at 12:32

0 Answers0