...in JAVASCRIPT ๐
Save for later.
1. Date.now()
Date.now()
This method returns the number of milliseconds elapsed since Jan 1, 1970 00:00:00 UTC.
2. getFullYear()
new Date().getFullYear()
Get the year as a 4 digit number (yyyy).
3. getMonth()
new Date().getMonth() + 1
Get month as a number (0-11).
4. getDay()
const day = new Date().getDay()
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thurs', 'Fri', 'Sat']
console.log(days[day])
Get weekday as a number (0-6).
5. getDate() ๐๐
new Date().getDate()
Get the day as a number (1-31).
Hope you find one soon! ๐
P.S. Want the next post to be something specific? Do let me know in the comments.
๐ค๐ป
Top comments (1)
people looking to handle simple date formatting should checkout github.com/lukeed/tinydate by Luke , found it a week ago