3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timezone_string1 = 'America/Regina'; $timezone_string2 = 'Europe/Zurich'; $summer = '2012-06-01 00:00:00'; $winter = '2012-12-01 00:00:00'; $format = 'Y-m-d H:i:s T P e'; echo "Summer: $summer\n"; $timezone_object = timezone_open( $timezone_string1 ); $date_object_summer = date_create( $summer, $timezone_object ); var_dump( date_format( $date_object_summer, $format ) ); $timezone_object = timezone_open( $timezone_string2 ); $date_object_summer = date_create( $summer, $timezone_object ); var_dump( date_format( $date_object_summer, $format ) ); echo "\nWinter: $winter\n"; $timezone_object = timezone_open( $timezone_string1 ); $date_object_winter = date_create( $winter, $timezone_object ); var_dump( date_format( $date_object_winter, $format ) ); $timezone_object = timezone_open( $timezone_string2 ); $date_object_winter = date_create( $winter, $timezone_object ); var_dump( date_format( $date_object_winter, $format ) );

preferences:
32.47 ms | 407 KiB | 5 Q