I would like to get their timezone with names like 'Asia/Calcutta' or 'Australia/Darwin'
I have php installed on myserver and its time set to 'UTC'
The client's timezone offset could be detected by using the Date object's getTimezoneOffset() method. The getTimezoneOffset() method returns the time difference between UTC time and local time, that is the time offset, in minutes.
The user time zone is a client-specific time zone that can be defined for the user time and user date of each individual user in the user master record. It is contained in the system field sy-zonlo.
getTimezoneOffset() method is used to return the time difference between Universal Coordinated Time (UTC) and local time, in minutes. If your time zone is GMT+5, -300 (60*5) minutes will be returned. Daylight savings prevent this value from being constant. Parameter: This method does not accept any parameter.
For detecting timezone offset you can use this function:
function get_time_zone_offset( ) {
var current_date = new Date();
return parseInt(-current_date.getTimezoneOffset() / 60);
}
Example you can see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With