我需要根据字符串日期获取一年中的当前周。 例如 07.03.2023 => 2023 年第 10 周
在文档我找到了很多帮手,但一年中的那一周都没有。
<#assign aDate = theDate?date>
<!-- All kind of day of the week, month, year etc, -->
${aDate?string["EEE, MMM d, ''yy"]}
<!-- How to get the week of the year? -->
我如何仅使用 FreeMarker 模板获取日期中的星期几。 感谢您的帮助。
FreeMarker 使用 Java 简单日期格式模式 来格式化日期。您可以使用
w
模式来获取“一年中的一周”。所以你可以简单地做:
Current week number: ${.now?string['w']}