Dils Umesha Dils Umesha - 1 year ago 126
PHP Question

Timezone convert

this is my requirement.website admin add a time to an event. Then users will see that time according to user's current location time.

And this php code to convert any time to user current location's time.

$date = date_create('2000-01-01',timezone_open('Pacific/Nauru'));
echo date_format($date, 'Y-m-d H:i:sP') . "\n";

How to determine user timezone (ex:Europe/Moscow)

I have this js code to get timezone of user current location.

var visitortime = new Date();
var time = visitortime.getTimezoneOffset()/60;

But it alert a number(ex:+5.5)
Can you help me please

Answer Source

Use this code to get current users timezone.

var timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download