user3436467
user3436467

Reputation: 1775

convert json callback data to date

can i get help coverting this string to date format.

Here is the JSon name and value

notBefore: 1413936000000
notAfter: 1479427199000

I believe this needs to be converted to US format date mm/dd/yyyy

The callback string looks like this:

response.endpoints[0].details.cert.notBefore
response.endpoints[0].details.cert.notAfter

Upvotes: 0

Views: 61

Answers (1)

scniro
scniro

Reputation: 16979

Just go ahead and craft up a new Date

new Date(notBefore)

If your values are indeed strings, you can parseInt() them

JSFiddle Example

If you need a simple example for mm/dd/yyyy format, here is a working fiddle to get you up and running.

var notBefore = 1413936000000;
var date = new Date(notBefore);
var formattedDate = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();

With Basic Format JSFiddle

Upvotes: 3

Related Questions