Soliman
Soliman

Reputation: 441

fullcalendar.js 24 hour calendar

How do I change from am/pm to 24 hour time format?

Upvotes: 3

Views: 11267

Answers (5)

blackjack
blackjack

Reputation: 1131

You need to set axisFormat. See the following code:

<p:schedule value="#{scheduleView.lazyEventModel}" timeFormat="HH:mm" axisFormat="HH:mm"/>

It displays in 24h format

Upvotes: 0

Jez
Jez

Reputation: 260

I use this

$('#calendar').fullCalendar({
events: [
    {
        //pull from my database the events
    }
    // other events here...
],
timeFormat: 'H(:mm)'
});

Upvotes: 1

spinsch
spinsch

Reputation: 1415

It works for me

timeFormat: {
   agenda: 'HH:mm{ - HH:mm}'
}

Upvotes: 1

Ivo Wetzel
Ivo Wetzel

Reputation: 46756

You have to customize the timeFormat property on the calendar object.
http://arshaw.com/fullcalendar/docs/text/timeFormat/

Upvotes: 2

Soliman
Soliman

Reputation: 441

Change h(:mm)tt and /h:mm{ - h:mm} to H in fullcalendar.js

setDefaults({
    allDaySlot: true,
    allDayText: 'all-day',
    firstHour: 6,
    slotMinutes: 30,
    defaultEventMinutes: 120,
    axisFormat: 'H', //,'h(:mm)tt',
    timeFormat: {
        agenda: 'H' //h:mm{ - h:mm}'
    },
    dragOpacity: {
        agenda: .5
    },
    minTime: 0,
    maxTime: 24
});

Upvotes: 9

Related Questions