Blog Stats
  • Posts - 7
  • Articles - 0
  • Comments - 12
  • Trackbacks - 14

 

Sunday, August 28, 2005

Converting Windows time to Unix time, with VBscript

Some command line tools ask for the UNIX time. If you’re using Jscript, this is no a problem. But VBscript doesn’t have a function that does this.

 

So here is some nice one-liner that gives the UNIX time

 

WScript.echo DateDiff("s", "12/31/1969 00:00:00", _
 DateSerial(Year(Now), Month(Now), Day(Now)) _
 + TimeSerial(Hour(Now), Minute(Now), Second(Now)))

 

 

Copyright © Michel Klomp