简体   繁体   English

FullCalendar,如何更改日期格式?

[英]FullCalendar, how do I change the date format?

I am trying to make the date format of FullCalendar dd/mm. 我正在尝试使用FullCalendar dd / mm的日期格式。 How can I do this? 我怎样才能做到这一点? I found [this][1] method, but I am not really sure how to edit it in my case. 我发现[this] [1]方法,但我不确定如何在我的情况下编辑它。 I am trying to make it so that in the dayView, the header shows the date in dd/mm format, rather than the current mm/dd American format. 我试图使它在dayView中,标题以dd / mm格式显示日期,而不是当前的mm / dd美国格式。

Is it possible to do this? 是否有可能做到这一点?

Sure, you can play with the titleFormat jsFiddle 当然,你可以使用titleFormat jsFiddle

$('#calendar').fullCalendar({
    titleFormat: {
        month: 'MMMM yyyy',
        week: "MMM d[ yyyy]{ '—'[ MMM] d yyyy}",
        day: 'MM/dd'
    },

Check out this link 看看这个链接

http://arshaw.com/fullcalendar/docs/text/titleFormat/ http://arshaw.com/fullcalendar/docs/text/titleFormat/

You can specify which view you want to edit through this (in your case the day view) 您可以通过此指定要编辑的视图(在您的情况下为日视图)

http://arshaw.com/fullcalendar/docs/views/View_Option_Hash/ http://arshaw.com/fullcalendar/docs/views/View_Option_Hash/

So you would probably have something along the lines of 所以你可能会有类似的东西

titleFormat: {

day: 'dddd, d MMM, yyyy'   //whatever date format you want here
} 

正如我在其他地方编写的那样您可以使用此未记录的配置变量对日期/月份的所有外观进行一般更改,因此您不必为每个视图指定它:

dayOfMonthFormat: 'ddd DD/MM',

Fullcalender has a few utilities functions you can use. Fullcalender有一些您可以使用的实用程序功能。 You can get at these after the calender has been loaded through the $.fullCalendar.formatDate(, 'dd/mm'). 在通过$ .fullCalendar.formatDate(,'dd / mm')加载日历后,您可以获得这些信息。 There are also a few others that are work a look.. http://arshaw.com/fullcalendar/docs/utilities/ 还有一些其他工作看起来.. http://arshaw.com/fullcalendar/docs/utilities/

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

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