Getting Browser Timezone

On the browser:

var d = new Date();
jQuery('#browserTimeOffset').val(Math.round(d.getTimezoneOffset() * 60));

On the server:

$browserTimeOffset = $_REQUEST['browserTimeOffset'];
$sql = "UPDATE member SET timeZoneOffsetInSeconds=unix_timestamp(utc_timestamp()) - unix_timestamp(now()) - $browserTimeOffset WHERE memberId=$memberId"
$offset = 555;  // Whatever the value of the timeZoneOffsetInSeconds column for this member
$sql = "SELECT cmnu.dModifiedDate + INTERVAL $offset second as dLastModifiedDate ..."

This method stores number of seconds offset between the browser and the database server. The timezone of my database server was America/Los_Angeles (where I lived, and does not need to be GMT).

If we do not want to use the above method, we can perhaps use relative date and times as mentioned in

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License