getMonth() trap in Javascript

by Matti Lehtinen December 14, 2009 19:07

In .NET DateTime.Month returns the month as integer between 1 and 12. Corresponding thing in JavaScript is Date.getMonth() but values are from 0 to 11.

Ok, it is common to start indexing from zero but the confusing part is that JavaScript’s Date.getDate() returns values from 1 to 31 so it is not analogous to getMonth(). Be aware of that trap when playing with dates in JavaScript.

Tags:

JavaScript

Comments

1/30/2010 8:43:57 PM #

contractor accountants

I am not much of a guy who thinks in so deeply about web design but I think your post had some valid points in it. Like designers are forced to design stuff within the limited code available and not go beyond it, their innovation is somewhat limited but still I think Web Design won't die! I agree that Amazon and other some big sites won't have a blog but now a days it's very important to have some sort of option available so people can quickly communicate their thoughts. I think Amazon if wants to shift it to that, they can get a customized CMS for themselves.

contractor accountants United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen | Modified by Mooglegiant