JavaScript WCF Date Formats

Here is a little cheat sheet to help you see the output of the function used when parsing a WCF JSON Formatted Response.

#”result” is the return object from the web service.

var sdate = new Date(parseInt(result.mydate.substr(6)));

#You can handle formatting the response with any of function below.

parsedDate: Tue Jun 17 2014 14:15:45 GMT-0400 (Eastern Daylight Time)
sdate.getDay(): 2
sdate.getDate(): 17
sdate.getFullYear(): 2014
sdate.getHours(): 14
sdate.getMilliseconds(): 777
sdate.getMinutes(): 15
sdate.getMonth(): 5
sdate.getSeconds(): 45
sdate.getTimezoneOffset(): 240
sdate.getUTCDate(): 17
sdate.getUTCDay(): 2
sdate.getUTCFullYear(): 2014
sdate.getUTCHours(): 18
sdate.getUTCMilliseconds(): 777
sdate.getUTCMinutes(): 15
sdate.getUTCMonth(): 5
sdate.getUTCSeconds(): 45
sdate.getYear(): 114

Hope this was useful, Enjoy!

Find out how to handle WCF JSON Date Response with HTML5



About Art Hicks

I am Business Owner/Applications Engineer that specializes in providing rich solutions to my clients and colleagues.
This entry was posted in JavaScript, jQuery. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s