I have a Date
object. How do I render the title
portion of the following snippet?
function getdatetime() {
d = new Date();
return (1e3-~d.getUTCMonth()*10+d.toUTCString()+1e3+d/1)
.replace(/1(..)..*?(\d+)\D+(\d+).(\S+).*(...)/,'$3-$1-$2T$4.$5Z')
.replace(/-(\d)T/,'-0$1T');
}
I found the basics on Stack Overflow somewhere (I believe it was part of some other Stack Exchange code golfing), and I improved it so it works on Internet Explorer 10 or earlier as well. It's ugly, but it gets the job done.