Javascript Date Object incosistency in month numbering? -
i'm confused date in js... know months numbered 0-11, sa creating
var x = new date(2014, 2, 1)
will give me 1st of march. creating var x = new date(2014, 2, 0)
gives february, x.getdate() give me not number of days in march, in february... should rather return days of march if number 2 (with numeration 0)?
also there way set monday first day of week in getday() method?
the months ranges 0 11.0 being january wheres day of month start 1, if use 0 in day gives previous months last day.so in case should use
var x = new date(2014, 1, 1) // 1st feb 2014
you can change start of week monday
follows
date.prototype.mgetday = function() { return (this.getday() + 6) %7; }
refer article details
Comments
Post a Comment