Converting VBScript's TimeValue Function
Definition: Returns a Variant of subtype Date containing the time.
OK, so you have a string value (say, 1:45 AM) and you’d like to convert that to a date-time value, is that right? No problem; Windows PowerShell can do that for you. In this command we not only assign the string 1:45 AM to the variable $a, but we also explicitly give $a a datetime data type:
$a = [datetime] "1:45 AM"
When you run this command (assuming it was run on 9/21/2006) and then echo back the value of $a you should get the following:
Thursday, September 21, 2006 1:45:00 AM