For example, the following code returns at the current time: 1368299689
Option Explicit Dim dtmdate If WScript.Arguments.Named.Count > 0 Then Syntax with WScript.Arguments.Unnamed ' Check command line arguments If. Count = 0 Then dtmdate = Now If. Count > 0 Then dtmdate =. Item (0) If. Count > 1 Then dtmdate = dtmdate & "" &. Item (1) If. Count > 2 Then dtmdate = dtmdate & "" &. Item (2) If.
Count > 3 Then Syntax On Error Resume Next dtmdate = CDate (dtmdate) If Err Then On error Goto 0 Syntax End If in Error Goto 0 If not IsDate (dtmdate) Then Syntax end With ' Calculate ' and display the result wscript.ec Ho DateDiff ("s", "1970-01-01 00:00:00", dtmdate) Sub Syntax WScript.Echo _ & "vbCrLf, Date2utc.vbs Sion 1.00 "_ & VbCrLf _ &" Convert any date/time to Unix time (UTC) "_ & VbCrLf & VbCrLf _ & "Usage:cscript. EXE//nologo Date2utc.vbs Date [Time] "_ & VbCrLf & VbCrLf _ &" Where: "" DAte "" is the date to convert (Default:current date/time) "_ & VbCrLf _ &" "" "" "" " Ptional time to convert ' _ & vbCrLf & vbCrLf _ & ' Notes:though often called UTC, Unix time do
Es not take to account Leap "_ & VbCrLf _ &" seconds, while "official" "UTC does." _
& VbCrLf _ & "If" specified date is ambiguous, the current user ' s date ' _ & VbCrLf _ & ' and time ' format is assumed. ' _ & VbCrLf & VbCrLf _ & ' written by Rob van de
R Woude "_ & VbCrLf _ &" http://www.robvanderwoude.com "Wscript.Quit 1 End Sub
The above is the entire contents of this article, I hope you can enjoy.