1
Sikandar
Current Client Date and time?
  • 2009/12/13 4:11

  • Sikandar

  • Just popping in

  • Posts: 99

  • Since: 2005/5/19


Hi All,
Is there any way I can display current date and time of client not of server.

thanks

2
ghia
Re: Current Client Date and time?
  • 2009/12/13 8:56

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You have to use a little JavaScript in your theme to do that.

3
culex
Re: Current Client Date and time?
  • 2009/12/14 10:23

  • culex

  • Module Developer

  • Posts: 711

  • Since: 2004/9/23


You can use something like this in your theme
le="color: #000000"><?php <script language="javascript"> // Set vars date, hour, minutes var currentTime = new Date() var hours = currentTime.getHours() var minutes = currentTime.getMinutes() // if less than 10 add a preceeding zero to the minute if (minutes < 10) minutes = "0" + minutes // print the time document.write("The time is now : " + hours + ":" + minutes + " "); </script>
Ups didnt see Ghias link. His example is better :)