|
楼主 |
发表于 2018-11-6 21:18
|
显示全部楼层
- Sub test()
- s = "var str=1541487600000;"
-
- s = s & "function getMyDate(str) {"
- s = s & "var oDate = new Date(str), "
- s = s & "oYear = oDate.getFullYear(),"
- s = s & "oMonth = oDate.getMonth()+1,"
- s = s & "oDay = oDate.getDate(),"
- s = s & "oHour = oDate.getHours(),"
- s = s & "oMin = oDate.getMinutes(),"
- s = s & "oSen = oDate.getSeconds(),"
- s = s & "oTime = oYear +'-'+ addZero(oMonth) +'-'+ addZero(oDay) +' '+ addZero(oHour) +':'+addZero(oMin) +':'+addZero(oSen);"
- s = s & "return oTime;}"
-
- s = s & "function addZero(num){"
- s = s & "if(parseInt(num) < 10){"
- s = s & "num = '0'+num;}"
- s = s & "return num;}"
-
- s = s & "getMyDate(str);"
-
- Set oDom = CreateObject("HTMLFILE")
- Set oWindow = oDom.parentWindow
- oWindow.execScript
-
- MsgBox oWindow.eval(s)
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|