-
Bug
-
Resolution: Fixed
-
Minor
-
4.1.10, 4.2.7, 4.3.4
If you pass a timestamp as a string (which is how it would come out of the DB) instead of an int, you get different results:
core_date::strftime('%c', '1708405742'); --> 28 February 5742 at 5:08 pm
core_date::strftime('%c', 1708405742); --> 20 February 2024 at 5:09 am
While depricated in 8.1 and up, strftime gives a very different (and more expected) result:
strftime('%c', '1708405742'); --> Tue 20 Feb 05:09:02 2024
strftime('%c', 1708405742); --> Tue 20 Feb 05:09:02 2024
I also just noticed the format is different, but I was mostly concerned about the actual date/time being parsed incorrect.
I know this is barely used in core (I think date_format_string() is the only thing that directly uses it), and there is a separate ticket to depreciate strftime (MDL-77366) in core completely, but I figured I should at least raise this for others who might run across it.