I receive a date time as a string from the server that might look like this:
07/08/2012 13:17:32
This is a UTC time.
Or it might have timezone in format:
07/08/2012 13:17:32 UTC+01:00
I need a general way to parse this into a Date object for display. If I do a var d = new Date(str) then the first example it assumes is a local time.
Edit:
It might not always be ‘UTC’ in the string, I think it could be GMT, or Z, or any other timezone signifier.
Any ideas?
If your timezone is always in format UTC+nn, and strings with explicit UTC TZ are parsed correctly, as I assume from your question, then simple
will do.