A simple and awesome method:
yourDate.toISOString().split('T')[0]
But be careful! This result based on UTC date and time.
We're a place where coders share, stay up-to-date and grow their careers.
A simple and awesome method:
yourDate.toISOString().split('T')[0]
But be careful! This result based on UTC date and time.
Suraj Vishwakarma -
Maegan Wilson -
Emmanuel Etukudo -
KaRthick -
Discussion
To get locale date and time, use
new Date().getTimezoneOffset()
in minutes, so it becomesI prefer this
It work, thanks dut