I appreciate that set_localized_time is deprecated but I’m assuming that the pre-2.6 behaviour should still work for the time being. With a mostly vanilla 2.6 install I’m seeing the following when I call set_localized_time(timestamp).
Severity: Notice Message: Undefined index: Europe/London Filename: libraries/Localize.php Line Number: 720
It looks as though the deprecation notice is incomplete as well:
Deprecated function set_localized_time() called in /blah/blah.php on line 230. Deprecated since 2.6. Use instead.
I take it that $use_instead should be format_date()?
If it makes any difference I’m using the second preview build.
Hi Dom Stubbs,
Since set_localized_time() is old, it only works with the old timezone notation, which you can see in the array keys in the _get_php_timezone() function. In order to make EE 2.6 work with any timezone and do automatic DST handling, we had to switch to storing the actual timezone name which the old code isn’t written for. That said, we’d strongly discourage using set_localized_time() because of that, and also since the DST settings are no longer stored, it won’t account for that properly either. Plus, manipulating a Unix timestamp which is supposed to be in GMT to make it look like it’s in another timezone is janky, we’d rather everyone move off of it ASAP. For backwards compatibility for your addon, you may want to check the EE version and conditionally use one method or the other, or just require 2.6.
Yes I’m guessing I didn’t enter a $use_instead variable because there isn’t really a 1-to-1 match for what this method did, I think what you’re seeing is more of a developer log bug which cropped up in the latest preview, I’ll fix that.
Let us know if you have any other issues.
Kevin
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.