以月份名称日,年份格式打印日期

时间:2014-10-04 06:02:50

标签: date ms-word word-vba

我希望以月份名称日,年份格式打印当前日期(例如:2014年10月3日)。我了解我可以使用Month(Date)Month(Now)以整数格式获取当前月份,但我想知道如何以文本格式输出当前月份。

1 个答案:

答案 0 :(得分:0)

在等待没有人回答这个问题时,我发现您可以使用MonthName( number, [ abbreviate ] )功能打印月份名称。从我的示例中可以看出,此函数的参数是number,它是1到12表示月份的值,而abbreviate是可选的boolean。如果此参数设置为TRUE,则表示月份名称将缩写。如果此参数设置为FALSE或省略,则月份名称不会缩写;现在让我们回过头来回答这个问题。

由于Month(Date)返回月份编号,您可以将其设置为MonthName(); so MonthName(月(日期))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(月(日期))&的第一个参数; " " &安培;日(日期)& "," &安培;年份(日期)`。