PHP timezone_transitions_get() Function

P
PHP timezone_version_get() Function
PHP timezone_open() Function

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.

ParameterDescription
objectThe DateTime object (for procedural way) – required
timestamp_startStarting timestamp – Optional
timestamp_endEnding timestamp – Optional
PHP timezone_transition_get() method

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()));
?>
PHP timezone_version_get() Function
PHP timezone_open() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z