Connecting Tech Pros Worldwide Help | Site Map

javascript default date is one month off

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 6th, 2005, 06:25 AM
ahmedbm@gmail.com
Guest
 
Posts: n/a
Default javascript default date is one month off

I just noticed that all my javascript months are off by one
month.....didn't test multiple systems tho and my system date is fine.

Any way of fixing this?

TIA,
Ahmed


  #2  
Old December 6th, 2005, 06:35 AM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default Re: javascript default date is one month off

ahmedbm@gmail.com writes:
[color=blue]
> I just noticed that all my javascript months are off by one
> month.....didn't test multiple systems tho and my system date is fine.
>
> Any way of fixing this?[/color]

Most likely by realising that the results returned by Date's getMonth
is zero-based, i.e., 0 for January and 11 for December. Knowing that
instantly makes the results correct :)

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
  #3  
Old December 6th, 2005, 06:45 AM
ahmedbm@gmail.com
Guest
 
Posts: n/a
Default Re: javascript default date is one month off

lol, i guess that answers my question! :)

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.