25
Sefie
6y

Javascript being Javascript...

var date = new Date()
Mon Aug 13 2018 09:17:28 GMT+0200 (Mitteleuropäische Sommerzeit)

date.getDay()
1

date.getDate()
13

date.getFullYear()
2018

date.getYear()
118

Comments
  • 2
    @norman70688 TIL
  • 6
    @Ovyerus if I recall correctly isn’t getMonth() also zero-indexed?
  • 2
    @Ovyerus that one burned me hard as well. Basically a ticking bomb since the getDate and getDay aligned on this week
  • 3
    Same shit happens in Perl just know how to use your language correctly zzz

    (Year is -1900 current year and month is 0-based)
  • 1
    Some start at zero
    Some start at one
    So stupid.
  • 0
    date.getTime();

    848493947585849293747
Add Comment