xoops forums

Sikandar

Just popping in
Posted on: 2009/12/13 4:11
Sikandar
Sikandar (Show more)
Just popping in
Posts: 99
Since: 2005/5/19
#1

Current Client Date and time?

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

thanks

ghia

Community Support Member
Posted on: 2009/12/13 8:56
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#2

Re: Current Client Date and time?

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

culex

Module Developer
Posted on: 2009/12/14 10:23
culex
culex (Show more)
Module Developer
Posts: 705
Since: 2004/9/23
#3

Re: Current Client Date and time?

You can use something like this in your theme
<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 :)