代码
复制代码代码如下:
<script type = "text/javascript">
var format = function (tempo, formato) {
var t = nova data (hora);
var tf = function (i) {return (i <10? '0': '') + i};
Retornar formato.Replace (/yyyy | mm | dd | hh | mm | ss/g, função (a) {
Switch (a) {
Caso 'AAAA':
retornar tf (t.getlyear ());
quebrar;
case 'mm':
retornar tf (t.getMonth () + 1);
quebrar;
case 'mm':
retornar tf (t.getMinutes ());
quebrar;
case 'dd':
retornar tf (t.getdate ());
quebrar;
caso 'hh':
retornar tf (t.gethours ());
quebrar;
caso 'ss':
retornar tf (t.getSeconds ());
quebrar;
};
});
};
alerta (formato (1396178344662, 'yyyy-mm-dd hh: mm: ss'));
</script>