Menu

Date & Time Format Specifiers

In Web2Cal, you can customize the date and time format being displayed.

 

Formatting codes:

FormatDescriptionExample
s The seconds of the minute between 0-59. "0" to "59"
ss The seconds of the minute with leading zero if required. "00" to "59"
m The minute of the hour between 0-59. "0" or "59"
mm The minute of the hour with leading zero if required. "00" or "59"
h The hour of the day between 1-12. "1" to "12"
hh The hour of the day with leading zero if required. "01" to "12"
H The hour of the day between 0-23. "0" to "23"
HH The hour of the day with leading zero if required. "00" to "23"
d The day of the month between 1 and 31. "1" to "31"
dd The day of the month with leading zero if required. "01" to "31"
ddd Abbreviated day name. "Mon" to "Sun"
dddd The full day name. "Monday" to "Sunday"
M The month of the year between 1-12. "1" to "12"
MM The month of the year with leading zero if required. "01" to "12"
MMM Abbreviated month name. "Jan" to "Dec"
MMMM The full month name. "January" to "December"
yy The year as a two-digit number. "99" or "08"
yyyy The full four digit year. "1999" or "2008"
t Displays the first character of the A.M./P.M. designator. "A" or "P"
tt Displays the A.M./P.M. designator. "AM" or "PM"
S The ordinal suffix ("st, "nd", "rd" or "th") of the current day. "st, "nd", "rd" or "th"

 

Variables that can be customized in Web2Cal with a date/time format

NameConstant NameDescription
Month Title Web2CalConstants.MONTH_TITLE_DATE_FORMAT Title displayed in month view
Month Header Web2CalConstants.MONTH_HEADER_FORMAT Date displayed in header in month view
Default Date Web2CalConstants.DATE_FORMAT Web2Cal adds an implicit attribute to all events. _formattedStartDate / _formattedEndDate. This constant specifies the format for the implicit attribute
Default Time Web2CalConstants.TIME_FORMAT Web2Cal adds an implicit attribute to all events. formattedStartTime / formattedEndTime. This constant specifies the format for the implicit attribute
Week Title Web2CalConstants.WEEK_TITLE_DATE_FORMAT1 & WEEK_TITLE_DATE_FORMAT2 Date displayed in title for Week View
Agenda Title Web2CalConstants.AGENDA_TITLE_DATE_FORMAT1 & AGENDA_TITLE_DATE_FORMAT2 Date displayed in title for Agenda View
Workshift Title Web2CalConstants.WS_TITLE_DATE_FORMAT Date displayed in title for Workshift View
W2C Title Web2CalConstants.W2C_TITLE_DATE_FORMAT Date displayed in title for W2C View

 

Examples

Web2Cal.DATE_FORMAT="MM/dd/yyyy";
Web2Cal.TIME_FORMAT="hh:mm tt";
Web2Cal.WEEK_TITLE_DATE_FORMAT1="MMM d"; // "Apr 4"
Web2Cal.WEEK_TITLE_DATE_FORMAT2="MMM d, yyyy"; // "Apr 10, 2010"
Web2Cal.WEEK_HEADER_DATE_FORMAT="ddd, MMM d"; // "Tue, Apr 6"
Web2Cal.MONTH_TITLE_DATE_FORMAT="MMMM, yyyy"; // "April, 2010"
Web2Cal.AGENDA_TITLE_DATE_FORMAT1="MMM d"; // "Apr 4"
Web2Cal.AGENDA_TITLE_DATE_FORMAT2="MMM d, yyyy"; // "Apr 10, 2010" 

ABOUT US