Highlighted

JavaScript :: Date & TIME

Luigi_247_365

11-11-2008

Hi,

I know this is elemental, but here goes:



Can somebody please give me some handy script/objects for DATE & TIME!

Example: Set a Date/Time field to the Date & TIME now! (Javascript only please)



Date.getDate()

now()

????

Replies

Highlighted

Luigi_247_365

11-11-2008

For my peeps...



JAVASCRIPT



var d, s;



s = "";

d = new Date();



s += "" + d.getFullYear() + "/";

s += "" + zeroPad(d.getMonth() + 1) + "/";

s += "" + zeroPad(d.getDate());

s += " ";

s += "" + zeroPad(d.getHours()) + ":";

s += "" + zeroPad(d.getMinutes()) + ":";

s += "" + zeroPad(d.getSeconds());



this.rawValue = s;



var str;

function zeroPad(intVal)

{

str = "" + intVal;

if (intVal < 10)

{

str = "0" + intVal;

}

return str;

}