Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

Hey PowerShell Guy !,How Can I Separate The Month From the Year in a Date String Like 122007?

How Can I Separate The Month From the Year in a Date String Like 122007?

[datetime]::ParseExact(122007,'Myyyy',$null) | ft Month,Year

You can see you can use ParseExact to convert a custom format to d dateTime OBject from there it is simple of course

PS> [datetime]::ParseExact(122007,'Myyyy',$null)

zaterdag 1 december 2007 0:00:00


PS l> [datetime]::ParseExact(122007,'Myyyy',$null) | fl Month,Year


Month : 12
Year  : 2007
 

Enjoy,

Greetings /\/\o\/\/

Published Friday, April 04, 2008 8:11 PM by MoW
Filed under: , ,

Comments

# re: Hey PowerShell Guy !,How Can I Separate The Month From the Year in a Date String Like 122007?

And what is $null doing there. I meant what is the syntax ?

Friday, April 25, 2008 1:22 PM by Preetamz

# ?????????????? ?????? ?? ?????????????? « PowerShell ?? ???????????? ??????????????

Anonymous comments are disabled