user2085143 user2085143 - 2 months ago 7
AngularJS Question

JavaScript Date Formating

I have a date string like so

'2016-06-16 00:00:00'

and would like to convert to this format

'2016-06-16T19:30:00.000Z'

Is there a standard approach for doing this? Angular may also be used!

Answer

This is default javascript function to get date like this:

new Date().toISOString();