…meie igapäevast IT’d anna meile igapäev…

2010-02-02

JavaScript dates: get Monday, get Sunday, get last day of a month

  1. function getMonday(d)
  2. {
  3.     return new Date(d.getFullYear(), d.getMonth(), d.getDate() – d.getDay() + 1);
  4. }
  5. function getSunday(d)
  6. {
  7.     return new Date(d.getFullYear(), d.getMonth(), d.getDate() – d.getDay() + 7);
  8. }
  9. function getLastDayOfMonth(d)
  10. {
  11.     return new Date(d.getFullYear(), d.getMonth() + 1, 0);
  12. }

Advertisements

1 kommentaar »

  1. You ought to take part in a contest for one of the highest quality
    blogs online. I am going to highly recommend this
    website!

    kommentaar kirjutas Telefon Sex Omas — 2017-04-25 @ 11:19:06 | Vasta


RSS feed for comments on this post. TrackBack URI

Lisa kommentaar

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Muuda )

Twitter picture

You are commenting using your Twitter account. Log Out / Muuda )

Facebook photo

You are commenting using your Facebook account. Log Out / Muuda )

Google+ photo

You are commenting using your Google+ account. Log Out / Muuda )

Connecting to %s

Blog at WordPress.com.