Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

JavaScript :: Date & TIME

Luigi_247_365
Level 2
Level 2
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()

????
2 Replies
Luigi_247_365
Level 2
Level 2
var d = new Date();

orderDate.rawValue = d.toString();
Luigi_247_365
Level 2
Level 2
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;

}