Saturday, September 1, 2012

How to format a JSON date?

How to format a JSON date? Problems with Json Date ?


jsonDate :
         /Date(1224043200000)/



Solution : 
var date = new Date(parseInt(jsonDate.substr(6)));


 
The substr function takes out the "\/Date(" part, and the parseInt function gets the integer and ignores the ")\/" at the end. The resulting number is passed into the Date constructor.

Cheers !
Hope you got the Ans !
still having probs ? let me know by comments !

Know More About :
PHP Freelancing India



1 comment:

  1. Great post! Our google cloud training
    helps learners build practical skills in cloud computing using Google Cloud Platform services like Compute Engine, Cloud Storage, BigQuery, Dataflow, and Pub/Sub. It is job-oriented with hands-on labs and real-world projects, helping students and professionals improve productivity and build strong career opportunities in cloud and IT roles.

    ReplyDelete

Any Questions or Suggestions ?

About

Professional & Experienced Freelance Developer From India, Technologist, Software Engineer, internet marketer and Open Sources Developer with experience in Finance, Telecoms and the Media. Contact Me for freelancing projects.

Enter your email address:

Delivered by FeedBurner