Convert date format to other

Asked

Viewed 38 times

0

I would like to convert this date format:

Wed Jul 20 2016 17:55:00 GMT-0300 (BRT)

for this format:

2016-07-20T14:55:00.000-03:00

  • The first format you have is String or is a Date Object?

  • It’s a string @Sergio

  • That seems new Date('Wed Jul 20 2016 17:55:00 GMT-0300 (BRT)').toISOString(); but with -03:00 at the end :/ Where you need to use this string?

  • I’ll give you an example of my problem: I have a string A data de hoje é date. And I perform a replace, and where is the word date I substitute for 2016-07-20T14:55:00.000-03:00. So far so good, however, when I perform a console.log, he shows: A data de hoje é Wed Jul 20 2016 17:55:00 GMT-0300 (BRT). I didn’t really understand why it converted itself to this format, but wanted to convert back.

  • @Sergio, you got it ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.