I am trying to use the date()
function as an alternative to the now deprecated strftime()
function, and I need to know whether the date()
function formats the time like the strftime()
function according to the locale time.
As said by php.net in the strftime()
manual:
strftime — Format a local time/date according to locale settings
But in the date()
function manual date() it only says:
date — Format a Unix timestamp
So does it format the Unix timestamp to the locale settings?
2
Answers
You already linked the perfect source for information on that matter.
The format information on the
date()
docs page points to theDateTimeeInterface::format
page (https://www.php.net/manual/en/datetime.format.php) that states:Welcome on StackOverflow.
Date
formats a Unix timestamp.Unix timestamp means seconds from epoch.
Epoch is the Thursday, 01 January 1970 00:00:01.000
Where I live (CET), this is the Thursday, 01 January 1970 00:00:01.000 +01:00, so it depends on your locale
But if you set your locale, result is different:
About the languages, this method does not use "locales". All outputs are in English.