javascript - Stripping milliseconds from Extended ISO format -
javascript's date.toisostring()
function returns string in following format:
yyyy-mm-ddthh:mm:ss.sssz
how can strip milliseconds such string? is, desire string in format:
yyyy-mm-ddthh:mm:ssz
since iso date format fixed width until millisecond portion, alternative splitting on '.' use substring
, replace "z" timezone designator:
var d = new date() d.toisostring().substring(0,19)+'z' "2015-07-01t21:27:45z"
Comments
Post a Comment