Export (0) Print
Expand All
Expand Minimize
1 out of 2 rated this helpful - Rate this topic

Converting VBScript's MonthName Function


Windows PowerShell


Definition: Returns a string indicating the specified month

MonthName

Sometimes all you want to know is that we’re in month number 9; at other times you’d prefer to know the name of the month (e.g., September). In Windows PowerShell you can determine the name of the month by using the Get-Date Cmdlet and then using the -f formatting parameter and the value MMMM. In other words, this command will retrieve the name of the month for the current month and store that value in the variable $a:



$a = get-date -f "MMMM"

When you run this command and then echo back the value of $a you should get the following (depending on the actual month):



September


Return to the VBScript to Windows PowerShell home page

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.