简体   繁体   English

如何修改Ghost.org博客的日期格式

[英]How can I modify my Ghost.org blog's date format

My Ghost.org blog displays dates as: 我的Ghost.org博客显示日期为:

04 Nov 2013 2013年11月4日

This is controlled in content\\themes\\{theme-name}\\post.hbs via: 这在content\\themes\\{theme-name}\\post.hbs通过以下方式控制:

<time datetime="{{date format="YYYY-MM-DD"}}">
    {{date format='DD MMM YYYY'}}
</time> 

I want this changed to a different format, like Wednesday, 4th November 2013 , how can I do this? 我希望将其更改为不同的格式,例如Wednesday, 4th November 2013我该怎么做?

Ghost uses Moment.js to output dates. Ghost使用Moment.js输出日期。

From their display format documentation we can determine that: 从他们的显示格式文档中我们可以确定:

  • dddd can be used to output the full day name; dddd可用于输出全天名称;
  • MMMM can be used to output the full month name; MMMM可用于输出完整的月份名称;
  • Do can be used to output the date in 1st 2nd 3rd 4th... format; Do可用于输出日期1st 2nd 3rd 4th...格式;
  • YYYY can be used to output the full year number. YYYY可用于输出全年数字。

From this we can craft our desired date format in content\\themes\\{theme-name}\\post.hbs using: 从这里我们可以使用以下content\\themes\\{theme-name}\\post.hbscontent\\themes\\{theme-name}\\post.hbs制作我们想要的日期格式:

<time datetime="{{date format="YYYY-MM-DD"}}">
    {{date format='dddd, MMMM Do YYYY'}}
</time>

Wednesday, 4th November 2013 2013年11月4日星期三

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM