D
Dave Rado
1) I want to be able to display the date in dd format.
If in my script file I have:
var dd = DayOfMonthArray[now.getDate()];
and in my html page I have:
<script type="text/javascript">
document.write(dd);
</script>
Then the date displays in d fomat, so instead of 01 I get 1.
But if in my script file I have:
var DayOfMonthArray = new Array
("01","02","03","04","05","06","07","08",
"09","10","11","12","13","14","15","16","17","18","19","20","21","22",
"23","24","25","26","27","28","29","30","31");
var dd = DayOfMonthArray[now.getDate()];
and in my html page I have:
<script type="text/javascript">
document.write(dd);
</script>
Then it adds 1 to the date!! So instead of 01 I get 02! Why? And what's
the best way of getting round it?
2) I want to be able to display the year in yy format. now.getYear()
displays the yeat in yyyy format; what is the best way to get it to
display in yy format?
Dave
If in my script file I have:
var dd = DayOfMonthArray[now.getDate()];
and in my html page I have:
<script type="text/javascript">
document.write(dd);
</script>
Then the date displays in d fomat, so instead of 01 I get 1.
But if in my script file I have:
var DayOfMonthArray = new Array
("01","02","03","04","05","06","07","08",
"09","10","11","12","13","14","15","16","17","18","19","20","21","22",
"23","24","25","26","27","28","29","30","31");
var dd = DayOfMonthArray[now.getDate()];
and in my html page I have:
<script type="text/javascript">
document.write(dd);
</script>
Then it adds 1 to the date!! So instead of 01 I get 02! Why? And what's
the best way of getting round it?
2) I want to be able to display the year in yy format. now.getYear()
displays the yeat in yyyy format; what is the best way to get it to
display in yy format?
Dave