My brief article on working with the [System.DateTime] .Net Class has been posted on PowerShell Magazine. It contains some quick tips on how to utilize this class to work with DateTime objects and how to convert strings to a DateTime object.
For example when converting the ‘accountexpires’ property of an AD account. This can be done as follows:
$Expires = ([adsisearcher]'(samaccountname=jaapbrasser)').FindOne().Properties['accountExpires'] [DateTime]::FromFileTime($Expires) |
For more tips regarding this topic, please refer to the article on PowerShell Magazine:
http://www.powershellmagazine.com/2012/10/04/pstip-working-with-datetime-objects-in-powershell-using-system-datetime/