Option Explicit With WScript.Arguments Select Case .Unnamed.Count Case 1 ' Specified date must be in yyyy-mm-dd format If UBound( Split( .Unnamed(0), "-" ) ) <> 2 Then Syntax ' Calculate and display the difference in seconds between the specified and the Unix time base date WScript.Echo DateDiff( "s", "1970-01-01 00:00:00", .Unnamed(0) ) Case 2 ' Specified date must be in yyyy-mm-dd format If UBound( Split( .Unnamed(0), "-" ) ) <> 2 Then Syntax ' Specified time must be in hh:mm or hh:mm:ss format If UBound( Split( .Unnamed(1), ":" ) ) < 1 Then Syntax If UBound( Split( .Unnamed(1), ":" ) ) > 2 Then Syntax ' Calculate and display the difference in seconds between the specified and the Unix time base date WScript.Echo DateDiff( "s", "1970-01-01 00:00:00", .Unnamed(0) & " " & .Unnamed(1) ) Case Else Syntax End Select If .Named.Count > 0 Then Syntax End With Sub Syntax WScript.Echo vbCrLf _ & "ISO2UTC.vbs, Version 1.00" _ & vbCrLf _ & "Convert an ISO date/time to Unix time (UTC)" _ & vbCrLf & vbCrLf _ & "Usage: CSCRIPT.EXE //NoLogo ISO2UTC.vbs iso_date [ iso_time ]" _ & vbCrLf & vbCrLf _ & "Where: ""iso_date"" is the ISO date we want to convert (YYYY-MM-DD format)" _ & vbCrLf _ & " ""iso_time"" is the optional time component (HH:mm[:ss] format)" _ & vbCrLf & vbCrLf _ & "Note: Though often called UTC, Unix time does not take into account leap" _ & vbCrLf _ & " seconds, while ""official"" UTC does." _ & vbCrLf & vbCrLf _ & "Written by Rob van der Woude" _ & vbCrLf _ & "http://www.robvanderwoude.com" WScript.Quit 1 End Sub