Javascript and the Date object

October 2nd, 2007 – sprocketrocket

I learned a few new things about the Javascript Date object today:

  1. When using this constructor: new Date(year, month, day);, month is 0 based. So, if you want to create a date object for September 30, 2007, it would look like this: new Date(2007, 8, 30);
  2. It’s far better to use a completely different constructor - one that takes a date string, parses it, and returns a valid date object. So like this: new Date('9/30/2007'); will generate September 30, 2007.
ADD TO STUMBLEUPON ADD TO DEL.ICIO.US ADD TO NEWSVINE ADD TO FURL ADD TO NETSCAPE ADD TO TECHNORATI FAVORITES ADD TO SQUIDOO ADD TO WINDOWS LIVE ADD TO YAHOO MYWEB ADD TO ASK ADD TO GOOGLE

Posted in The Geeks, sprocketrocket, Firefox, Microsoft .Net, Visual Studio 2005 |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.