9

I have a UTC date string, "2011-10-30T18:30:00Z", and I want to convert it to "2011-10-30 18:30". Can anyone give me some advice how to do this? I would appreciate for your time and consideration.

Thanks

Sinal
  • 1,155
  • 5
  • 17
  • 35

2 Answers2

22

The easiest solution is to try the following:

var date = new Date("2011-10-30T18:30:00Z");

This will convert it into a normal Javascript date, at which point you can use whatever data operators you like.

NT3RP
  • 15,262
  • 9
  • 61
  • 97
5
str=str.replace(/T|\:\d\dZ/g,' ')
kennebec
  • 102,654
  • 32
  • 106
  • 127