Click to See Complete Forum and Search --> : jscript that displays only month year
Ron Wolpa
12-12-2003, 08:37 PM
............................................................................
Most of Jscripts Iīve found are complete calendars or show
date month year hour ;
I only need a script to display : mont year
by the order ;
Any hint ?
Cheers
RW
............................................................................
fredmv
12-12-2003, 08:38 PM
<script type="text/javascript">
//<![CDATA[
var n = new Date();
document.write(n.getMonth() + ' ' + n.getFullYear());
//]]>
</script>
Ron Wolpa
12-12-2003, 10:37 PM
Thank you !
It works pretty good , ;
However what I want is to display the month written :
exactly like this : December 2003 ,
and as the year turns January 2004 and so on , is there a way to change a bit the code ?
thank you very much
RW
fredmv
12-12-2003, 10:44 PM
<script type="text/javascript">
//<![CDATA[
var n = new Date(), m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
document.write(m[n.getMonth()] + ' ' + n.getFullYear());
//]]>
</script>
Ron Wolpa
12-12-2003, 11:00 PM
Thank you once again
Thatīs it !
now working as I need
Cheers
RW
fredmv
12-12-2003, 11:05 PM
You're welcome. :D