note 125452 added to class.intlgregoriancalendar
| From: | JulianSawicki@php.net | Date: | Thu, 22 Oct 2020 12:29:31 +0000 |
| Subject: | note 125452 added to class.intlgregoriancalendar | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215629@lists.php.net to get a copy of this message | ||
I was using
IntlGregorianCalendar because it offered a nice way to get the week number
of the year as an integer. This differs from DateTime; DateTime gives you
the week number of the year as an string.
<?php
$dateTime = new DateTime('21-09-2020 09:00:00');
echo $dateTime->format("W"); // string '39'
$intlCalendar = IntlCalendar::fromDateTime ('21-09-2020 09:00:00');
echo $intlCalendar->get(IntlCalendar::FIELD_WEEK_OF_YEAR); // integer 39
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.174 (proxied: 178.238.103.130)
----
Manual Page -- http://php.net/manual/en/class.intlgregoriancalendar.php
Edit -- https://master.php.net/note/edit/125452
Del: integrated -- https://master.php.net/note/delete/125452/integrated
Del: useless -- https://master.php.net/note/delete/125452/useless
Del: bad code -- https://master.php.net/note/delete/125452/bad+code
Del: spam -- https://master.php.net/note/delete/125452/spam
Del: non-english -- https://master.php.net/note/delete/125452/non-english
Del: in docs -- https://master.php.net/note/delete/125452/in+docs
Del: other reasons-- https://master.php.net/note/delete/125452
Reject -- https://master.php.net/note/reject/125452
Search -- https://master.php.net/manage/user-notes.php