日历

  • #calendars: 与#dates类似,但用于java.util.Calendar对象。
  1. /*
  2. * ======================================================================
  3. * See javadoc API for class org.thymeleaf.expression.Calendars
  4. * ======================================================================
  5. */
  6. /*
  7. * Format calendar with the standard locale format
  8. * Also works with arrays, lists or sets
  9. */
  10. ${#calendars.format(cal)}
  11. ${#calendars.arrayFormat(calArray)}
  12. ${#calendars.listFormat(calList)}
  13. ${#calendars.setFormat(calSet)}
  14. /*
  15. * Format calendar with the ISO8601 format
  16. * Also works with arrays, lists or sets
  17. */
  18. ${#calendars.formatISO(cal)}
  19. ${#calendars.arrayFormatISO(calArray)}
  20. ${#calendars.listFormatISO(calList)}
  21. ${#calendars.setFormatISO(calSet)}
  22. /*
  23. * Format calendar with the specified pattern
  24. * Also works with arrays, lists or sets
  25. */
  26. ${#calendars.format(cal, 'dd/MMM/yyyy HH:mm')}
  27. ${#calendars.arrayFormat(calArray, 'dd/MMM/yyyy HH:mm')}
  28. ${#calendars.listFormat(calList, 'dd/MMM/yyyy HH:mm')}
  29. ${#calendars.setFormat(calSet, 'dd/MMM/yyyy HH:mm')}
  30. /*
  31. * Obtain calendar properties
  32. * Also works with arrays, lists or sets
  33. */
  34. ${#calendars.day(date)} // also arrayDay(...), listDay(...), etc.
  35. ${#calendars.month(date)} // also arrayMonth(...), listMonth(...), etc.
  36. ${#calendars.monthName(date)} // also arrayMonthName(...), listMonthName(...), etc.
  37. ${#calendars.monthNameShort(date)} // also arrayMonthNameShort(...), listMonthNameShort(...), etc.
  38. ${#calendars.year(date)} // also arrayYear(...), listYear(...), etc.
  39. ${#calendars.dayOfWeek(date)} // also arrayDayOfWeek(...), listDayOfWeek(...), etc.
  40. ${#calendars.dayOfWeekName(date)} // also arrayDayOfWeekName(...), listDayOfWeekName(...), etc.
  41. ${#calendars.dayOfWeekNameShort(date)} // also arrayDayOfWeekNameShort(...), listDayOfWeekNameShort(...), etc.
  42. ${#calendars.hour(date)} // also arrayHour(...), listHour(...), etc.
  43. ${#calendars.minute(date)} // also arrayMinute(...), listMinute(...), etc.
  44. ${#calendars.second(date)} // also arraySecond(...), listSecond(...), etc.
  45. ${#calendars.millisecond(date)} // also arrayMillisecond(...), listMillisecond(...), etc.
  46. /*
  47. * Create calendar (java.util.Calendar) objects from its components
  48. */
  49. ${#calendars.create(year,month,day)}
  50. ${#calendars.create(year,month,day,hour,minute)}
  51. ${#calendars.create(year,month,day,hour,minute,second)}
  52. ${#calendars.create(year,month,day,hour,minute,second,millisecond)}
  53. ${#calendars.createForTimeZone(year,month,day,timeZone)}
  54. ${#calendars.createForTimeZone(year,month,day,hour,minute,timeZone)}
  55. ${#calendars.createForTimeZone(year,month,day,hour,minute,second,timeZone)}
  56. ${#calendars.createForTimeZone(year,month,day,hour,minute,second,millisecond,timeZone)}
  57. /*
  58. * Create a calendar (java.util.Calendar) object for the current date and time
  59. */
  60. ${#calendars.createNow()}
  61. ${#calendars.createNowForTimeZone()}
  62. /*
  63. * Create a calendar (java.util.Calendar) object for the current date (time set to 00:00)
  64. */
  65. ${#calendars.createToday()}
  66. ${#calendars.createTodayForTimeZone()}