LaravelConf Taiwan 2020 CFP Started


(PHP 5 >= 5.5.0, PHP 7, PECL >= 3.0.0a2)

IntlCalendar::fromDateTimeCreate an IntlCalendar from a DateTime object or string


Style orienté objet

public static IntlCalendar::fromDateTime ( mixed $dateTime ) : IntlCalendar

Style procédural

intlcal_from_date_time ( mixed $dateTime ) : IntlCalendar

Creates an IntlCalendar object either from a DateTime object or from a string from which a DateTime object can be built.

The new calendar will represent not only the same instant as the given DateTime (subject to precision loss for dates very far into the past or future), but also the same timezone (subject to the caveat that different timezone databases will be used, and therefore the results may differ).

Liste de paramètres


A DateTime object or a string that can be passed to DateTime::__construct().

Valeurs de retour

The created IntlCalendar object or NULL in case of failure. If a string is passed, any exception that occurs inside the DateTime constructor is propagated.


Exemple #1 IntlCalendar::fromDateTime()


//same as IntlCalendar::fromDateTime(new DateTime(...))
$cal1 IntlCalendar::fromDateTime('2013-02-28 00:01:02 Europe/Berlin');

//Note the timezone is Europe/Berlin, not the default Europe/Lisbon
echo IntlDateFormatter::formatObject($cal1'yyyy MMMM d HH:mm:ss VVVV''de_DE'), "\n";

L'exemple ci-dessus va afficher :

2013 Februar 28 00:01:02 Deutschland Zeit

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top