Fetching client time using JavaScript and comparing them with values stored in the database I am developing a module, where:


The administrator enters time in (0-23) format.These values gets saved in database.
In the front end (for the website users) I need to fetch the current client time (not the server time), maybe using JavaScript, and then comparing it with the stored time (in PHP variables with current time fetched using JavaScript).


I want to do something like the following.

// $time_one: from the database.
// $time_two: from the database.
// $currentTime:  client current time.

if (currentTime &gt; $time_one &amp;&amp; currentTime &lt; $time_two) {
  // Display some message.
}


How can this be done? Can PHP and JavaScript be mixed in the module file?
Send server time to the client side via js variables: drupal_add_js, see example.