How to calculate the start of the day.
I calculate by => moment().startOf('day').toISOString()
it returns
2019-09-12T00:00:00.000
But I want to in this format "2019-09-12 00:00:00.000"
How can we get,Please help me.
Instead of using .toISOString()
method you can simply use format()
.
As per momentjs doc here
.toISOString()
returns a timestamp in UTC, even if the moment in question is in local mode.
Use it like this:
moment().startOf('day').format('YYYY-MM-DD hh:mm:ss:SSS')
Hope this helps happy coding!!!
var formatedDate= moment().startOf('day').format('YYYY-MM-DD HH:mm:ss,sss');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.