FullCalendar, how do I change the date format?

 ̄綄美尐妖づ 提交于 2019-12-07 08:18:42

问题


I am trying to make the date format of 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. 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.

Is it possible to do this?


回答1:


Check out this link

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/

So you would probably have something along the lines of

titleFormat: {

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



回答2:


Sure, you can play with the titleFormat jsFiddle

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



回答3:


As I have written elsewhere on SO you can use this undocumented config variable to make a general change for all appearances of date/month so you don't have to specify it per view:

dayOfMonthFormat: 'ddd DD/MM',



回答4:


Fullcalender has a few utilities functions you can use. You can get at these after the calender has been loaded through the $.fullCalendar.formatDate(, 'dd/mm'). There are also a few others that are work a look.. http://arshaw.com/fullcalendar/docs/utilities/



来源:https://stackoverflow.com/questions/9491450/fullcalendar-how-do-i-change-the-date-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!