Start page
Start page

Start page / Template development / Template syntax / Data types / GregorianCalendar

Data type GregorianCalendarAvailable from FirstSpirit Version 4.0

Value range of the GregorianCalendar data type

FirstSpirit provides the data type GregorianCalendar for calculations with date and time values. This data type represents a Gregorian calendar and enables interpretation of different date formats as Year, Month, Day, Hour, Minute and Second. The data type provides access to a range of methods which fall back on the calendar and relevant regional schema settings of the operating system (e.g. data formats) and therefore enable formatting in different, for example country-specific date formats and parsing.

The data type GregorianCalendar can also be looked up in the Sun API documentation:

java.util.GregorianCalendar

Definition using the standard input components

Different input components can be defined in the form area of a page or section template. These form elements can then be used to insert the actual editorial contents into the page. The Standard input components supported by FirstSpirit return different data types.

The following standard input components return an object of data type GregorianCalendar:

Methods on GregorianCalendar objects

The table below lists all methods which can be invoked on objects of data type GregorianCalendar:

Method name Return type Brief description Available since
add(int, int) void
add(String, int) Calendar
add(String, Number) Calendar
after(Date) boolean
after(Object) boolean
before(Date) boolean
before(Object) boolean
clear void
clear(int) void
compareTo(Date) int
compareTo(Calendar) int
compareTo(Comparable) int
compareTo(Object) int
equals(Date) boolean
equals(Object) boolean
format(String) String Formatting date and time specification
format(String, Locale) String
format(String, String) String
get(int) int
getActualMaximum(int) int
getActualMinimum(int) int
getAvailableLocales Locale[]
getClass Class Class of the invoking object
getDisplayName(int, int, Locale) String
getDisplayNames(int, int, Locale) Map
getFirstDayOfWeek int
getGreatestMinimum(int) int
getGregorianChange Date
getInstance Calendar
getInstance(TimeZone) Calendar
getInstance(Locale) Calendar
getInstance(TimeZone, Locale) Calendar
getLeastMaximum(int) int
getMaximum(int) int
getMinimalDaysInFirstWeek int
getMinimum(int) int
getTime Date
getTimeInMillis long
getTimeZone TimeZone
getWeekYear int
getWeeksInWeekYear int
hashCode int
isCase(Object) boolean
isLeapYear(int) boolean
isLenient boolean
isNull boolean Checks whether an expression is null (zero)
isSet(int) boolean
isWeekDateSupported boolean
milliseconds long
minus(long) Date
plus(long) Date
print void
roll(int, int) void
roll(int, boolean) void
set(int, int) void
set(String, Number) Calendar
set(String, Object) Object
set(int, int, int) void
set(int, int, int, int, int) void
set(int, int, int, int, int, int) void
setFirstDayOfWeek(int) void
setGregorianChange(Date) void
setLenient(boolean) void
setMinimalDaysInFirstWeek(int) void
setTime(Date) void
setTimeInMillis(long) void
setTimeZone(TimeZone) Calendar
setTimeZone(String) Calendar set the time zone of the given date (see documentation of 'java.util.TimeZone.getTimeZone(java.lang.String)' for valid time zone names) 4.2.23
setTimezone(TimeZone) Calendar
setTimezone(String) Calendar
setWeekDate(int, int, int) void
toJson String Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings) 4.2.14
toString String
type String

add(int, int)

Method name Return type Available since
add(int, int) void

add(String, int)

Method name Return type Available since
add(String, int) Calendar

add(String, Number)

Method name Return type Available since
add(String, Number) Calendar

after(Date)

Method name Return type Available since
after(Date) boolean

after(Object)

Method name Return type Available since
after(Object) boolean

before(Date)

Method name Return type Available since
before(Date) boolean

before(Object)

Method name Return type Available since
before(Object) boolean

clear

Method name Return type Available since
clear void

clear(int)

Method name Return type Available since
clear(int) void

compareTo(Date)

Method name Return type Available since
compareTo(Date) int

compareTo(Calendar)

Method name Return type Available since
compareTo(Calendar) int

compareTo(Comparable)

Method name Return type Available since
compareTo(Comparable) int

compareTo(Object)

Method name Return type Available since
compareTo(Object) int

equals(Date)

Method name Return type Available since
equals(Date) boolean

equals(Object)

Method name Return type Available since
equals(Object) boolean

format(String)

The method format(String) can be used to define how time and date information are to be displayed.

For this purpose, characters are used as formatting symbols. The function of a character in upper case can be different from the same character in lower case. In principal, a formatting symbol consists of one character, by specifiying more than one (maximal up to four) equal characters the format of the time or date information can be differentiated.

The following list shows all existing formatting symbols, first the frequently used ones:

  • Specification of the year
    • yy: specification of the year two-digit (e.g. "96")
    • yyyy: specification of the year four-digit (e.g. "2010")
  • Specification of the month
    • MM: specification of the month, if one-digit with leading 0 (e.g. "03")
    • MMM: specification of the month, three-lettered language-specific abbreviation (e.g. "Mar")
    • MMMM: specification of the month, long, language-specific (e.g. "March")
  • Specification of the day
    • d: day of month (e.g. "26")
    • D: day of year (e.g. "145")
    • E: name of the weekday, three-lettered language-specific abbreviation (e.g. "Wed")
    • EEEE: name of the weekday, long, language-specific (e.g. "Wednesday")
    • F: weekday of the month (e.g. "2", i.e.. 2nd day of month x)
  • Specification of the hour
    • K: hour of day, 12-hour notation (0-11) (e.g. "0")
    • h: hour of day, 12-hour notation (1-12) (e.g. "12")
    • H: hour of day, 24-hour notation (0-23) (e.g. "0")
    • k: hour of day, 24-hour notation (1-24) (e.g. "24")
    • a: specification of AM / PM (forenoon / afternoon) (e.g. "PM")
  • Specification of the minute
    • m: specification of the minute one-digit (0-59) (e.g. "2")
    • mm: specification of the minute two-digit, if one-digit with leading 0 (0-59) (e.g. "02")
  • Specification of the second
    • s: specification of the second one-digit (0-59) (e.g. "2")
    • ss: specification of the second two-digit, if one-digit with leading 0 (0-59) (e.g. "02")
  • Specification of the week
    • w: calendar week (1-52) (e.g. "12")
    • W: week of the month (1-5) (e.g. "2")
  • Specification of the time zone
    • Z: time zone according to RFC 822 (e.g. "+0200")
    • z: general name of the time zone, language-specific abbreviation (e.g. "CEST")
    • zzzz: general name of the time zone, long, language-specific (e.g. "Central European Summer Time")
  • Specification of milli seconds
    • S - SSS: milli second (0-999) (e.g. "978")
  • Specification of the era
    • G: era, language-specific (e.g. "AD")

These symbols can be used separately or combined. Space characters, dots, colons, comma, hyphens, slashes etc. can be used as separator. For outputting date and time information even more individual, additional text can be specified in simple inverted comma, e.g. Date:' dd.MM.yyyy, 'time:' HH:mm. If you would like to output a simple inverted comma, use '' (two inverted commas).

Examples:

  • "dd.MM.yyyy G 'at' hh:mm:ss 'o'clock' z"
    Output: 20.06.2010 AD at 05:41:53 o'clock CEST
  • "EEE, MMM d, ''yy"
    Output: Sun, Jun 20, '07
  • "h:mm a"
    Output: 5:43 PM
  • "hh 'o'clock,' zzzz"
    Output: 05 o'clock, Central European Summer Time
  • "K:mm a, z"
    Output: 5:44 PM, CEST
  • "yyyy.MMMM.dd G hh:mm a"
    Output: 2010.June.20 AD 05:45 PM
  • "dd.MM.yyyy HH:mm:ss.SSS"
    Output: 20.06.2010 17:59:23.208

Method name Return type Available since
format(String) String

format(String, Locale)

Method name Return type Available since
format(String, Locale) String

format(String, String)

Method name Return type Available since
format(String, String) String

get(int)

Method name Return type Available since
get(int) int

getActualMaximum(int)

Method name Return type Available since
getActualMaximum(int) int

getActualMinimum(int)

Method name Return type Available since
getActualMinimum(int) int

getAvailableLocales

Method name Return type Available since
getAvailableLocales Locale[]

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getDisplayName(int, int, Locale)

Method name Return type Available since
getDisplayName(int, int, Locale) String

getDisplayNames(int, int, Locale)

Method name Return type Available since
getDisplayNames(int, int, Locale) Map

getFirstDayOfWeek

Method name Return type Available since
getFirstDayOfWeek int

getGreatestMinimum(int)

Method name Return type Available since
getGreatestMinimum(int) int

getGregorianChange

Method name Return type Available since
getGregorianChange Date

getInstance

Method name Return type Available since
getInstance Calendar

getInstance(TimeZone)

Method name Return type Available since
getInstance(TimeZone) Calendar

getInstance(Locale)

Method name Return type Available since
getInstance(Locale) Calendar

getInstance(TimeZone, Locale)

Method name Return type Available since
getInstance(TimeZone, Locale) Calendar

getLeastMaximum(int)

Method name Return type Available since
getLeastMaximum(int) int

getMaximum(int)

Method name Return type Available since
getMaximum(int) int

getMinimalDaysInFirstWeek

Method name Return type Available since
getMinimalDaysInFirstWeek int

getMinimum(int)

Method name Return type Available since
getMinimum(int) int

getTime

Method name Return type Available since
getTime Date

getTimeInMillis

Method name Return type Available since
getTimeInMillis long

getTimeZone

Method name Return type Available since
getTimeZone TimeZone

getWeekYear

Method name Return type Available since
getWeekYear int

getWeeksInWeekYear

Method name Return type Available since
getWeeksInWeekYear int

hashCode

Method name Return type Available since
hashCode int

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isLeapYear(int)

Method name Return type Available since
isLeapYear(int) boolean

isLenient

Method name Return type Available since
isLenient boolean

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

isSet(int)

Method name Return type Available since
isSet(int) boolean

isWeekDateSupported

Method name Return type Available since
isWeekDateSupported boolean

milliseconds

Method name Return type Available since
milliseconds long

minus(long)

Method name Return type Available since
minus(long) Date

plus(long)

Method name Return type Available since
plus(long) Date

print

Method name Return type Available since
print void

roll(int, int)

Method name Return type Available since
roll(int, int) void

roll(int, boolean)

Method name Return type Available since
roll(int, boolean) void

set(int, int)

Method name Return type Available since
set(int, int) void

set(String, Number)

Method name Return type Available since
set(String, Number) Calendar

set(String, Object)

Method name Return type Available since
set(String, Object) Object

set(int, int, int)

Method name Return type Available since
set(int, int, int) void

set(int, int, int, int, int)

Method name Return type Available since
set(int, int, int, int, int) void

set(int, int, int, int, int, int)

Method name Return type Available since
set(int, int, int, int, int, int) void

setFirstDayOfWeek(int)

Method name Return type Available since
setFirstDayOfWeek(int) void

setGregorianChange(Date)

Method name Return type Available since
setGregorianChange(Date) void

setLenient(boolean)

Method name Return type Available since
setLenient(boolean) void

setMinimalDaysInFirstWeek(int)

Method name Return type Available since
setMinimalDaysInFirstWeek(int) void

setTime(Date)

Method name Return type Available since
setTime(Date) void

setTimeInMillis(long)

Method name Return type Available since
setTimeInMillis(long) void

setTimeZone(TimeZone)

Method name Return type Available since
setTimeZone(TimeZone) Calendar

setTimeZone(String)

set the time zone of the given date (see documentation of 'java.util.TimeZone.getTimeZone(java.lang.String)' for valid time zone names)
Method name Return type Available since
setTimeZone(String) Calendar 4.2.23

setTimezone(TimeZone)

Method name Return type Available since
setTimezone(TimeZone) Calendar

setTimezone(String)

Method name Return type Available since
setTimezone(String) Calendar

setWeekDate(int, int, int)

Method name Return type Available since
setWeekDate(int, int, int) void

toJson

Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings)
Method name Return type Available since
toJson String 4.2.14

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2013-12-09