1

variable currently outputs as 2013-02-05T16:30:01Z

How do I use parseDate(), to change how the date is formatted?

captainrad
  • 3,760
  • 16
  • 41
  • 74
  • @args That's to do with parsing dates. This is about formatting dates. – Waleed Khan Mar 13 '13 at 20:23
  • @asgs I was unable to find anything helpful, I'll look around though! – captainrad Mar 13 '13 at 20:23
  • Yes, but it still has certain answers on formatting date strings. – asgs Mar 13 '13 at 20:24
  • 4
    Which parseDate are you talking about? That's not a native method of JavaScript at all. So your answer is going to rely on whose `.parseDate` it is you're actually using. – Norguard Mar 13 '13 at 20:29
  • What is `parseDate()`? And why do you want to use a *parse* function for *formatting*? – Bergi Mar 13 '13 at 20:29
  • 1
    Yes, you might want to tag this JQuery, if it's relevant. – asgs Mar 13 '13 at 20:29
  • possible duplicate of [Is there a built-in function or plugin to handle date formatting in JavaScript?](http://stackoverflow.com/questions/12632148/is-there-a-built-in-function-or-plugin-to-handle-date-formatting-in-javascript) or [Formatting a date in JavaScript](http://stackoverflow.com/questions/1056728/formatting-a-date-in-javascript) – Bergi Mar 13 '13 at 20:34
  • @Bergi if he's holding a string instead of a date object, he would need to parse it first. – phs Mar 14 '13 at 02:37

1 Answers1

7

You can use the object Date in order to define the Date.

var d = new Date('2013-02-05T16:30:01Z');

the variable d is now a Date object you can process all date methods. And I think that parseDate() is a jQuery UI method ($.datepicker.parseDate)

T J
  • 42,762
  • 13
  • 83
  • 138
misoukrane
  • 304
  • 2
  • 3