Option Explicit Dim blnDate, blnTime Dim intDateFormat, intTimeFormat, intValid Dim strResult blnDate = True blnTime = True intDateFormat = vbShortDate intTimeFormat = vbShortTime intValid = 0 strResult = "" With WScript.Arguments.Named If .Exists( "D" ) Then If .Exists( "T" ) Then Syntax blnDate = True blnTime = False intValid = intValid + 1 End If If .Exists( "T" ) Then blnDate = False blnTime = True intValid = intValid + 1 End If If .Exists( "L" ) Then If .Exists( "S" ) Then Syntax intDateFormat = vbLongDate intTimeFormat = vbLongTime intValid = intValid + 1 End If If .Exists( "S" ) Then intDateFormat = vbShortDate intTimeFormat = vbShortTime intValid = intValid + 1 End If If intValid <> .Count Then Syntax End With With WScript.Arguments.Unnamed If .Count < 1 Then Syntax If .Count > 2 Then Syntax ' Specified date must be in yyyy-mm-dd format If UBound( Split( .Item(0), "-" ) ) <> 2 Then Syntax ' Calculate and display the difference in seconds between the specified and the Unix time base date If blnDate Then strResult = FormatDateTime( CDate( .Item(0) ), intDateFormat ) If blnTime Then If .Count = 2 Then ' Specified date must be in yyyy-mm-dd format If UBound( Split( .Item(0), "-" ) ) <> 2 Then Syntax ' Specified time must be in hh:mm or hh:mm:ss format If UBound( Split( .Item(1), ":" ) ) < 1 Then Syntax If UBound( Split( .Item(1), ":" ) ) > 2 Then Syntax ' Calculate and display the difference in seconds between the specified and the Unix time base date If blnDate Then strResult = strResult & ", " strResult = strResult & FormatDateTime( CDate( .Item(1) ), intTimeFormat ) Else Syntax End If End If WScript.Echo strResult End With Sub Syntax WScript.Echo vbCrLf _ & "ISO2Date.vbs, Version 1.00" _ & vbCrLf _ & "Convert an ISO date/time to the current user's standard date/time format" _ & vbCrLf & vbCrLf _ & "Usage: ISO2Date.vbs iso_date [ iso_time ] [ /D | /T ] [ /L | /S ]" _ & vbCrLf & vbCrLf _ & "Where: ""iso_date"" is the mandatory ISO date to convert (YYYY-MM-DD format)" _ & vbCrLf _ & " ""iso_time"" is the optional time component (HH:mm[:ss] format)" _ & vbCrLf _ & " /D Return the date only (default: both date and time)" _ & vbCrLf _ & " /T Return the time only (/D and /T are mutually exclusive)" _ & vbCrLf _ & " /L Use long format (/L and /S are mutually exclusive)" _ & vbCrLf _ & " /S Use short format (default)" _ & vbCrLf & vbCrLf _ & "Note: When /T is used, iso_time becomes mandatory too." _ & vbCrLf & vbCrLf _ & "Written by Rob van der Woude" _ & vbCrLf _ & "http://www.robvanderwoude.com" WScript.Quit 1 End Sub