将 VB 脚本中的 yyyy/mm/dd 格式化为月份名称和日期
formatting yyyy/mm/dd in VB Script to Month name and day date
如何在 VBScript 中格式化 yyyy/mm/dd 以仅输出月份名称和日期 'Month Name' 'Day'
例如。 6 月 6 日
抱歉,如果这是一个糟糕的问题 - VBScript 的新手。我的研究发现只有超长的解决方案,只有数字格式和重新排列,我需要 月份名称!
最近的尝试(请注意我正在尝试使用 (DatePart("m"
但我还需要输出 HTML 等我在 <section id='
中写的
<%
today = Date
firstDay = DateValue("2015-05-10")
lastDay = DateValue("2015-06-08")
d = firstDay
While d <= lastDay
If d = today Then
response.write "today"
Else
response.write(DatePart("m","<section id='day_"& d &"' class='calSquare " & time &"'><article class='dateImage' style='background-image: url(images/Calendar_Thumbnails/Day_"&d&".jpg)'></article></article><article class='dateTitle'> "&d&suffix&"</article></section>"))
End If
d = d + 1
Wend
<!--response.write(products(0))-->
%>
以上失败;也尝试过 MonthName 但无法正确维护我正在填充的 html.. 关于如何输出 MonthName 的任何建议,然后只是数字日期,维护我的 HTML 我如上面的代码所示动态填充?
您可以使用MONTHNAME函数。它需要一个整数而不是日期,因此您可以执行以下操作。
MONTHNAME(MONTH("1/12/2015")) & " " & DAY("1/12/2015")
输出:
January 12
使用d.month获取月份,使用do.year获取年份。通过创建函数将 d.month 转换为月份名称
如何在 VBScript 中格式化 yyyy/mm/dd 以仅输出月份名称和日期 'Month Name' 'Day'
例如。 6 月 6 日
抱歉,如果这是一个糟糕的问题 - VBScript 的新手。我的研究发现只有超长的解决方案,只有数字格式和重新排列,我需要 月份名称!
最近的尝试(请注意我正在尝试使用 (DatePart("m"
但我还需要输出 HTML 等我在 <section id='
<%
today = Date
firstDay = DateValue("2015-05-10")
lastDay = DateValue("2015-06-08")
d = firstDay
While d <= lastDay
If d = today Then
response.write "today"
Else
response.write(DatePart("m","<section id='day_"& d &"' class='calSquare " & time &"'><article class='dateImage' style='background-image: url(images/Calendar_Thumbnails/Day_"&d&".jpg)'></article></article><article class='dateTitle'> "&d&suffix&"</article></section>"))
End If
d = d + 1
Wend
<!--response.write(products(0))-->
%>
以上失败;也尝试过 MonthName 但无法正确维护我正在填充的 html.. 关于如何输出 MonthName 的任何建议,然后只是数字日期,维护我的 HTML 我如上面的代码所示动态填充?
您可以使用MONTHNAME函数。它需要一个整数而不是日期,因此您可以执行以下操作。
MONTHNAME(MONTH("1/12/2015")) & " " & DAY("1/12/2015")
输出:
January 12
使用d.month获取月份,使用do.year获取年份。通过创建函数将 d.month 转换为月份名称