ColdFusion Date Obejcts, JSON and date formatting in javascript

So this one is mostly for me so I don't forget this in 6 months when I need it again.

ColdFuson does so much for us, but sometimes it tries to do too much and leaves you hanging. I had a simple object, essentially an appointment, which included a date time value retrieved from a MySQL databse. When I called the service method from ColdFusion, it's returned a standard CF date object to me that I could easily parse, but when I pulled the same object via jQuery(ajax / JSON) ColdFusion parsed the date object into a string like this:

June, 28 2012 20:00:00

 

Needless to say, the jQuery date formatting plugin I am using refused to parse it. My awesome co-worker Travis quickly pointed out that simply hitting the value with Date.parse(myDateString) would solve my problem.

 

Thanks Travis!

No comments yet.

(will not be published)
Leave this field empty: