Current Size:
Chakra BreakPoints
base0px
sm480px
md768px
lg992px
xl1280px
2xl1536px
Current Height:Width
widthpx
heightpx

Subjects

format date time

Date Created: 2022/02/15

Last Update: 2022/08/24

#javascript #notes

Examples

Option One

const date = new Date()
console.log(date) // Tue Feb 15 2022 05:33:57 GMT-0700 (Mountain Standard Time)

Option Two

const date = new Date().toDateString()
console.log(date) // Tue Feb 15 2022

Option Three

const options = {
timeZone: "America/New_York",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
}
const date = new Date().toLocaleDateString("en-us", options)
console.log(date) // Feb 15, 7:33 AM

References

How to format a number as a currency value in JavaScript

More Notes

All Notes
HomeProjects

Links

Home Articles Notes Projects About Style Guide Site Credits

Contact

 [email protected]

Location

🌎 Earth