In UNIX to obtain a timestamp from a date is pretty easy, I wonder if there is a script in vbscript to do the same. I would like to have "1/17/2004 6:01:48 PM" as an input parameter and as output the unique timestamp.
Well it sort of depends on what you mean by "timestamp" doesn't it?
For most COM/ActiveX purposes and many other places in Windows the vbDate type is used for this:
Dim dtStamp
dtStamp = CDate("1/17/2004 6:01:48 PM"
That's the basic idea at least, though "display date" strings like the one CDate converts are dependent on locale settings. For example is "2/3/2004" February 3rd or March 2nd?
For more control you can use DateSerial( ) or TimeSerial( ) to convert date and time component values into vbDate values.
The vbDate is implemented as a Double, an 8-byte floating-point value internally.
I'd like to know if it possible to test a text file for empty. I use this:
set inlees = fsoObject.OpenTextFile(textfile , 1)
strBuffer = textfile .ReadAll
which works fine if the textfile contains characters, but when the file is empty I get
Microsoft VBScript
runtime (0x800A003E)
Input past end of file, because the file is empty.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.