/*
* @title what time is it now
* @description iso8601 timestamp on prompt
* @include http://*
* @license MIT License
* @require
*/
(function(){
function trim(num,l){
if(num<0){
num=-(num);
}
if(typeof(num)!='string'){
num=''+num;
}
var s=l-num.length;
while(s>0){
num='0'+num;
--s;
}
return num;
}
;
var d=new Date,YYYY=trim(d.getFullYear(),4),MM_1=trim(d.getMonth()+1,2),DD=trim(d.getDate(),2),T='T',HH=trim(d.getHours(),2),MM_2=trim(d.getMinutes(),2),SS=trim(d.getSeconds(),2),offset=d.getTimezoneOffset(),plus='-',ZZ_1=trim(offset/60,2),ZZ_2=trim(offset%60,2),ISO;
if(offset<=0){
plus='+';
offset=-(offset);
}
;
ISO=YYYY+'-'+MM_1+'-'+DD+T+HH+':'+MM_2+':'+SS+plus+ZZ_1+':'+ZZ_2;
prompt('what time is it now',ISO);
}
)();