Search code examples
javascriptmomentjsmoment-timezone

To convert date format to the time stamp


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.


Solution

  • var formatedDate= moment().startOf('day').format('YYYY-MM-DD HH:mm:ss,sss');