Forums
This topic is locked
Formatting getDate()
Posted 12 Dec 2002 19:15:40
1
has voted
12 Dec 2002 19:15:40 Chris Rowe posted:
I'm trying to format the getDate() object. It works fine except on the days 1-9, I would like to add a "0" so that when I sort the date descending e.g. "12/11/2002" comes before "12/9/2002". Right now it's listed first because there is no "0" in front of the nine. But I don't want to add a zero on the days 10 - 31. Any help would be greatly appreciated. Thanks.Chris
Replies
Replied 12 Dec 2002 19:22:35
12 Dec 2002 19:22:35 Chris Rowe replied:
I forgot to add my code:
var A6 = new Date();
var A7 = A6.getMonth();
var A77 = A7 + 1;
var A8 = A6.getDate();
var A9 = A6.getFullYear();
document.write(A77 + '/' + A8 + '/' + A9);
var A6 = new Date();
var A7 = A6.getMonth();
var A77 = A7 + 1;
var A8 = A6.getDate();
var A9 = A6.getFullYear();
document.write(A77 + '/' + A8 + '/' + A9);