工具之formatDate

优质
小牛编辑
120浏览
2023-12-01

将 Date 对象格式化为字符串:

$.fullCalendar.formatDate( date, formatString [, options ] )

formatString 是下列命令的任意组合:

  • s – 秒
  • ss – 秒,两位
  • m – 分钟
  • mm – 分钟,两位
  • h – 小时,12小时制
  • hh – 小时,12小时制,2位
  • H – 小时,24小时制
  • HH – 小时,24小时制,2位
  • d – 日期
  • dd – 日期,2位
  • ddd – 短的日期名称
  • dddd – 完整的日期名称
  • M - 月
  • MM – 月,2位
  • MMM – 短的月名称
  • MMMM – 完整的月名称
  • yy – 年份,2位
  • yyyy – 年份,4位
  • t – ‘a’或者‘p’
  • tt – ‘am’或者‘pm’
  • T – ‘A’或者‘P’
  • TT – ‘AM’或者‘PM’
  • u - ISO8601格式
  • S - ’st’, ‘nd’, ‘rd’, ‘th’
  • W - ISO8601星期数

特殊字符:

‘…’ 文本

” 单引号(双引号表示单引号)

(…) 显示格式如果其中一个封闭的变量是零

options 参数可以用来覆盖默认的选择,例如monthNames, monthNamesShort, dayNames, 和 dayNamesShort.

官方英文文档:http://arshaw.com/fullcalendar/docs/utilities/formatDate/