[thelist] Date script (java)

Richard Bennett richard.bennett at skynet.be
Tue May 25 09:04:15 CDT 2004


hi,
>
> As I'm not a javascript guy, I'd like to ask u a simple question. I have
> this date script (look below) and I need it to write the number of day and
> month in 2 digits, for instance 05, or 07. How can I do that?
>
> Thanks in advance.
>
> <!--
> function write_date()
> {
> var thetime=new Date();
> var nday=thetime.getDay();
> var nmonth=thetime.getMonth();
> var ntoday=thetime.getDate();
> var nyear=thetime.getYear();
> var AorP=" ";
>

var nday=thetime.getDay();

var shortDay;
if(nday<10)shortDay="0"+nday;
else shortDay=nday;



Not tested, nut should be roughly ok.
Richard.




More information about the thelist mailing list