Posted By

davidwaterston on 01/14/13


javascript date shim ISO-8601

Versions (?)

Convert a Date object to an ISO 8601 formatted string

 / Published in: JavaScript


Javascript which converts a Date object into an ISO 8601 formatted string - 'YYYY-MM-DDTHH:mm:ss.sssZ' - with a fallback for when the function 'toISOString' doesn't exist (e.g. IE 8 or less).

Usage: var now = new Date; console.log(now.toISOString());

Validates clean in JSLint (Edition 2012-12-31).

Report this snippet  

You need to login to post a comment.