does anyone know how to make live javascript time running..
i have this php code
$expiredate = date(\'d m Y G:i:s\', $rdate1);
$f_ex_date =
It's doable on the client with a little bit of JavaScript. Without using a framework such as jQuery, which would be of marginal help here, the basic method would be something similar to the following:
Within the event handler:
As a concrete example, the following function will set up a simple date/time update with a named element:
function clock( id ) {
var target = document.getElementById( id );
if( target ) {
var callback = function() {
var datetime = new Date().toLocaleString();
target.innerHTML = datetime;
};
callback();
window.setInterval( callback, 1000 );
}
}
Note the use of new Date().toLocaleString() to retrieve and format the current date/time; also, the use of window.setInterval() to set up the callback to fire each second.