Function DateDiff($unit, $date1, $date2)
    Dim $sc, $result
    $sc = CreateObject("ScriptControl")
    $sc.Language = "vbscript"
    $result = $sc.Eval("DateDiff("+Chr(34)+$unit+Chr(34)+", "+Chr(34)+$date1+Chr(34)+", "+Chr(34)+$date2+Chr(34)+")")
    $sc = 0
    $DateDiff = $result
EndFunction
Function DateAdd($unit, $incr, $date)
    Dim $sc, $result
    $sc = CreateObject("ScriptControl")
    $sc.Language = "vbscript"
    $result = $sc.Eval("DateAdd("+Chr(34)+$unit+Chr(34) + ", " + $incr + ", " + Chr(34)+$date+Chr(34)+")")
    $sc = 0
    $DateAdd = $result
EndFunction
Function DatePart($unit, $date)
    Dim $sc, $result
    $sc = CreateObject("ScriptControl")
    $sc.Language = "vbscript"
    $result = $sc.Eval("DatePart("+Chr(34)+$unit+Chr(34)+", "+Chr(34)+$date+Chr(34)+")")
    $sc = 0
    $DatePart = $result
EndFunction
$testvalue = '2009/11/03 12:34:56'
$test1 = FormatDateTime($testvalue, 'vbShortDate')
$test2 = FormatDateTime($testvalue, 'vbLongDate')
$test3 = FormatDateTime($testvalue, 'vbLongTime')
$test4 = DateDiff('d', '7/19/2009', $testvalue)
$test5 = DateAdd('m', 1, $testvalue)
$test6 = DatePart('m', $testvalue)
? "shortdate...: $test1"
? "longdate....: $test2"
? "longtime....: $test3"
? "datediff....: $test4"
? "dateadd.....: $test5"
? "datepart....: $test6"