Windows Scripting Host

THIS PAGE IS INTENDED FOR TESTING.

1. create new object

js

var obj = new ActiveXObject("Scripting.FileSystemObject")

vb

set obj = CreateObject("Scripting.FileSystemObject")

 

 GetTimestamp

' Return: 20140605165050
Function GetTimestamp
    Dim s, d, t
    s = ""
    d = Now()

    s = s + CSTR(DatePart("yyyy", d))
    s = s + AddZeroPrefix(DatePart("m", d))
    s = s + AddZeroPrefix(DatePart("d", d))
    s = s + AddZeroPrefix(DatePart("h", d))
    s = s + AddZeroPrefix(DatePart("n", d))
    s = s + AddZeroPrefix(DatePart("s", d))

    GetTimestamp = s
End Function

Function AddZeroPrefix(a)
    Dim s
    If a < 10 Then
        s = "0" + CSTR(a)
    Else
        s = CSTR(a)
    End If
    
    AddZeroPrefix = s
End Function

 

posted @ 2014-06-05 10:29  sadcat  阅读(253)  评论(0编辑  收藏  举报