Closed petrparolek closed 2 years ago
For me this would be useful, but why is it static and not like return $formatter->format($this);
?
Instead of
echo Nette\Utils\DateTime::getIntlDateFormat(
format: 'LLLL YYYY HH:mm:ss',
time: new DateTimeImmutable('2021-02-01 15:47:21'),
locale: 'cs_CZ',
timeZone: 'Europe/Prague'
)
you can just use
echo IntlDateFormatter::formatObject(
datetime: new DateTimeImmutable('2021-02-01 15:47:21', new DateTimeZone('Europe/Prague')),
format: 'LLLL YYYY HH:mm:ss',
locale: 'cs_CZ',
);
For me this would be useful, but why is it static and not like
return $formatter->format($this);
?
thanks
I think it's better to use IntlDateFormatter::formatObject
thanks @dg and @JanTvrdik for solution
In Nette Utils I didn't find method which I could replace deprecated PHP function
strftime('%B', $datetime->getTimestamp()),
which I used to Czech translation of munth.I found solution at https://stackoverflow.com/a/46275845/6346869