javascript - Formatting a date in ISO 8601 to minute resolution -


i need format date\time value iso 8601 down minute resolution.

so in format of:

2007-03-01t13:00z

the native toisostring method on date returns seconds , fractionals:

2015-09-30t09:50:03.014z

how can knock off them parts desired format?

i don't think there's function this, below want using regex:

console.log(new date().toisostring().replace(/:\d+.\d+(\w)$/,'$1'))

date.prototype.toisostringminute = function() {    return this.toisostring().replace(/:\d+.\d+(\w)$/,'$1');  }    console.log(new date().toisostringminute())


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

html - Outlook 2010 Anchor (url/address/link) -