Skip to content

Instantly share code, notes, and snippets.

@koji
Created March 3, 2020 00:50
Show Gist options
  • Save koji/6bd9a5804487af68a7ac2b1e48734905 to your computer and use it in GitHub Desktop.
Save koji/6bd9a5804487af68a7ac2b1e48734905 to your computer and use it in GitHub Desktop.
javascript Date's get methods
  1. Date.getTime() Get the time in milliseconds elapsed since .

  2. Date.getFullYear() Get the four-digit year ().

  3. Date.getMonth() Get the Date object's month as a zero-indexed number ().

  4. Date.getDate() Get the Date object's day as a number ().

  5. Date.getDay() Get the Date object's weekday as a number ().
    ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

  6. Date.getHours() Get the Date object's hour ().

  7. Date.getMinutes() Get the Date object's minutes ()

  8. Date.getSeconds() Get the Date object's seconds ().

  9. Date.getMilliseconds() Get the Date object's milliseconds ().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment