Logan Kling
Logan Kling

Reputation: 589

Print date in Month name day, year format

I'm looking to print the current date in Month name day, year format (example: October 3, 2014). I understand that I can get the current month in integer format with Month(Date) or Month(Now), but I want to know how I would output the current month in text format.

Upvotes: 0

Views: 1155

Answers (1)

Logan Kling
Logan Kling

Reputation: 589

While waiting for nobody to answer this question I figured out that you can use the MonthName( number, [ abbreviate ] ) function to print the month name. As you can see from my example, the parameters of this function are number, which is a value from 1 to 12 representing the month, and abbreviate, which is an optional boolean. If this parameter is set to TRUE, it means that the month name will be abbreviated. If this parameter is set to FALSE or left out, the month name won't be abbreviated; now lets get back to answering the question.

Since Month(Date) returns the number of the month, you can set it as the first parameter of MonthName(); soMonthName(Month(Date))will return the name of the current month. You can then print the current date in the Month name day, year format with this code:MonthName(Month(Date)) & " " & Day(Date) & ", " & Year(Date)`.

Upvotes: 0

Related Questions