[PowerShell] Convert Month Mmm Format to Month Number

This way worked for me:

[Array]::indexof("000,Jan,Feb,Mar,Apr,Jun,Jul,Aug,Sep,Oct,Nov,Dec".Split(","),"Xxx")

Example:

PS> [Array]::indexof("000,Jan,Feb,Mar,Apr,Jun,Jul,Aug,Sep,Oct,Nov,Dec".Split(","),"Aug")
8

Note: It is case sensitive.

Image: Converting month Mmm format to number format with PowerShell

Comments