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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -