Thursday, February 14, 2013

Convert String to Date Time

Here is the method I used to convert text to timestamps:
 $strtimeManual = "2013-02-14-0200"
  
 $strtimeManual = [datetime]::ParseExact($strtimeManual ,"yyyy-MM-dd-HHmm",$null)
  
 $endtimeManual = "2013-02-14-0400"
  
 $endtimeManual = [datetime]::ParseExact($endtimeManual ,"yyyy-MM-dd-HHmm",$null)
  
 $MyStartDate = $strtimeManual 
  
 $MyEndDate = $endtimeManual  
http://codeformatter.blogspot.com/