New article on PowerShell Magazine: Working with [DateTime] Class

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/

2 thoughts on “New article on PowerShell Magazine: Working with [DateTime] Class

    1. Jaap Brasser Post author

      I’m glad you liked it Rafael! There is a lot of ‘hidden’ functionality in PowerShell once you know which .Net classes to utilize.

      Reply

Leave a Reply

Your email address will not be published.