PDA

View Full Version : How to make a two-digit GetDate variable?!


the_ngneer
12-04-2002, 08:25 AM
Hi all! I'm new to JS programming and I would like some help. In my script, I specify some variables, like this:

var Today=new Date();
var ThisDate=Today.getDate();
var ThisMonth=Today.getMonth()+1;
var ThisYear=Today.getFullYear();
var ShortYear=Today.getFullYear()-2000;

Now, I need the 'ThisDate' variable to be two-digit formatted. I probably need to insert a function to do this, but have no idea what the syntax would be. Please help me!


/Thx!

glenngv
12-04-2002, 08:28 AM
var ThisDate=Today.getDate();
if (ThisDate<10) ThisDate="0"+ThisDate;