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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -