R
R
roma_47112017-09-24 22:52:14
PHP
roma_4711, 2017-09-24 22:52:14

How to set timezones in php?

I need to convert a random timestamp to a date and display it in 3 time zones (Moscow, Tokyo, New York), help with this issue

<?php
    $a = strtotime('1980-01-01 00:00');
    $b = strtotime('1990-01-01 00:00');
    $c = rand($a,$b);
    $d = date('Y-m-d H:m', $c);
    echo $c . '<br>';
    echo $d;
  ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-09-24
@roma_4711

$date = new DateTime("2010-07-05T06:00:00Z", new DateTimeZone("Europe/Amsterdam"));
php.net/manual/en/refs.calendar.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question