Expression Utility Objects #calendars
Use #calendars in Expression Utility Objects.
[Tutorial: Using Thymeleaf \ (ja ) --19 Appendix B: Expression Utility Object --Calendar](https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf_ja.html#%E3%82%AB%E3 % 83% AC% E3% 83% B3% E3% 83% 80% E3% 83% BC)
/*
*Calendar object for the current date and time (java).util.Calendar)
*/
${#calendars.createNow()}
${#calendars.createNowForTimeZone()}
Prepare template HTML.
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>title</title>
</head>
<body>
<!-- #calendars.createNow() -->
<p th:text="${#calendars.format(#calendars.createNow(), 'yyyy year MM month dd day HH hour mm minute ss second')}"></p>
<!-- #calendars.createNowForTimeZone('UTC') -->
<p th:text="${#calendars.format(#calendars.createNowForTimeZone('UTC'), 'yyyy year MM month dd day HH hour mm minute ss second')}"></p>
<!-- #calendars.createNowForTimeZone('Asia/Tokyo') -->
<p th:text="${#calendars.format(#calendars.createNowForTimeZone('Asia/Tokyo'), 'yyyy year MM month dd day HH hour mm minute ss second')}"></p>
<!-- #calendars.createNowForTimeZone('GMT+0900') -->
<p th:text="${#calendars.format(#calendars.createNowForTimeZone('GMT+0900'), 'yyyy year MM month dd day HH hour mm minute ss second')}"></p>
</body>
</html>
-# calendars.createNow (),'Asia / Tokyo','GMT + 0900' are output in Japan Standard Time --'UTC' is output in Coordinated Universal Time (9 hours before Japan)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>title</title>
</head>
<body>
<!-- #calendars.createNow() -->
<p>September 14, 2019 09:01:23</p>
<!-- #calendars.createNowForTimeZone('UTC') -->
<p>September 14, 2019 00:01:23</p>
<!-- #calendars.createNowForTimeZone('Asia/Tokyo') -->
<p>September 14, 2019 09:00:23</p>
<!-- #calendars.createNowForTimeZone('GMT+0900') -->
<p>September 14, 2019 09:00:23</p>
</body>
</html>
-[Tutorial: Using Thymeleaf \ (ja ) --19 Appendix B: Expression Utility Object-Calendar](https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf_ja.html#%E3%82%AB% E3% 83% AC% E3% 83% B3% E3% 83% 80% E3% 83% BC)
Recommended Posts