In this article, you will learn how to get the transitions of the timezone. The PHP
timezone_transitions_get() function returns the timezone transitions.
What is the syntax of the timezone_transitions_get() function in PHP?
Procedural syntax?
Procedural syntax:
timezone_transitions_get(object, timestamp_start, timestamp_end)
Object-oriented syntax:
DateTimeZone::getTransitions(timestamp_start, timestamp_end)
Both of the above syntax produce the same results. The first is without using the class and
the second use the DateTimeZone class to call the method.
Parameter | Description |
---|---|
object | The DateTime object (for procedural way) – required |
timestamp_start | Starting timestamp – Optional |
timestamp_end | Ending timestamp – Optional |
Example of the timezone_transition_get() function
<?php
$zone = new DateTimeZone("Europe/Paris");
// procedural way
print_r(reset(timezone_transitions_get($zone)));
+
// OOP way
print_r(reset($zone->getTransitions()));
?>