PDA

View Full Version : Formatting string into date from a specific format



webfriend13
9 Nov 2012, 1:59 AM
HI all,

I have a string 20121109 (Ymd format or 2012 nov 09). I want to convert this string into a date by supplying the format. Please let me know how can i convert this string into date. I know I can split the string and then I can convert it into date but I dont want to go that way.


I have tried this but it did not worked:
var date = Date.parseDate('20121109', 'Ymd');

pcr
9 Nov 2012, 2:08 AM
For all date formatting etc I use moment.js.

Look at: http://momentjs.com/