addDays
Adds a specified number of days to a Time object.
Returns
The Time object resulting from adding the specified number of days to the given time.
Example
The following example adds 15 days to the current time and displays the result.
display "time in 15 days will be: " +
addDays('now', i : 15)
addHours
Adds a specified number of hours to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of hours to the given time.
Example
display "time in 12 hours will be: " +
addHours('now', i : 12)
addMicroSeconds
Adds a specified number of microseconds to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of microseconds to the given time.
Example
display "time in 500 microseconds will be: " +
addMicroSeconds('now', i : 500)
addMilliSeconds
Adds a specified number of milliseconds to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of milliseconds to the given time.
Example
display "time in 50000 milliseconds will be: " +
addMilliSeconds('now', i : 50000)
addMinutes
Adds a specified number of minutes to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of milliseconds to the given time.
Example
display "time in 30 minutes will be: " +
addMinutes('now', i : 30)
addMonths
Adds a specified number of months to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of months to the given time.
Example
display "time in 6 months will be: " +
addMonths('now', i : 6)
addSeconds
Adds a specified number of seconds to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of seconds to the given time.
Example
display "time in 50 seconds will be: " +
addSeconds('now', i : 50)
addWeeks
Adds a specified number of weeks to a Time object.
Arguments
Returns
The Time object resulting from adding the specified number of weeks to the given time.
Example
display "time in 50 weeks will be: " +
addWeeks('now', weeks : 50)
addYears
Adds a specified number of years to a Time object.
Arguments
Returns
display "time in 10 years will be: " +
addYears('now', i : 10)
add
Adds a specified interval of time to a Time object.
Arguments
Returns
The Time object resulting from adding the specified interval to the given time.
Example
display "time in 5 days 15 hours and 30 minutes: \n\n" +
add('now', interval : '5d15h30m')
between
Determines if the given Time object is between two Time objects.
Arguments:
Returns
true - if the given Time object is contained in the specified period.
false - if the given object is not contained in the specified period.
Example
display "is today between 2004-01-01 and 2004-12-31? "+
between('now', from : '2004-01-01 12:00:00',
@to : '2004-12-31 12:00:00')
daysSince
Calculates the days passed between a given time and another time.
Arguments
Returns
An Int value representing the number of days between the two given times.
Example
birthdate as Time
birthdate = '1979-02-19'
display "days passed since birthdate: " +
daysSince('now', t : birthdate)
formatDate
Formats the Time object with the default mask.
Arguments
Returns
A String containing the representation of the Time object formatted with the default mask.
Example
display formatDate('now')
formatDate
Formats the Time object with the specified date formatting style for the default locale.
Arguments
Returns
A String containing the representation of the Time object formatted with the specified style.
Example
defaultDate as String = "Default format --> " +
formatDate('now', dateStyle : Time.DEFAULT)
fullDate as String = "Full format --> " +
formatDate('now', dateStyle : Time.FULL)
longDate as String = "Long format --> " +
formatDate('now', dateStyle : Time.LONG)
shortDate as String = "Short format --> " +
formatDate('now', dateStyle : Time.SHORT)
display defaultDate + "\n\n" + fullDate + "\n\n" +
longDate + "\n\n" + shortDate + "\n\n"
formatTimeOnly
Formats this Time object as a time only, with no time zone correction.
Arguments
Returns
A String containing the representation of the Time object formatted as time only.
display formatTimeOnly('now')
formatTimeOnly
Formats this Time object as a time only, with no time zone correction, applying the specified style.
Arguments
Returns
A String containing the representation of the Time object formatted as time only, applying the specified style.
Example
defaultTime as String = "Default format --> " +
formatTimeOnly('now', intervalStyle : Time.DEFAULT)
fullTime as String = "Full format --> " +
formatTimeOnly('now', intervalStyle : Time.FULL)
longTime as String = "Long format --> " +
formatTimeOnly('now', intervalStyle : Time.LONG)
shortTime as String = "Short format --> " +
formatTimeOnly('now', intervalStyle : Time.SHORT)
display defaultTime + "\n\n" +
fullTime + "\n\n" +
longTime + "\n\n" +
shortTime + "\n\n"
formatTime
Formats the time component of a Time object with a specified style.
Arguments
Returns
A String containing the time component of the Time object formatted with the specified style.
Example
defaultTime as String = "Default format --> " +
formatTime('now', timeStyle : Time.DEFAULT)
fullTime as String = "Full format --> " +
formatTime('now', timeStyle : Time.FULL)
longTime as String = "Long format --> " +
formatTime('now', timeStyle : Time.LONG)
shortDate as String = "Short format --> " +
formatTime('now', timeStyle : Time.SHORT)
display defaultTime + "\n\n" +
fullTime + "\n\n" +
longTime + "\n\n" +
shortTime + "\n\n"
format
Formats a Time object with the default mask.
Arguments
Returns
A string containing the representation of the Time object formatted with the default mask.
Example
display format('now')
format
Formats a Time object with a specified date style and time style.
Arguments
Returns
A string containing the representation of the Time object whose date was formatted with the specified date style, and whose time was formatted with the specified time style.
Example
fullDateShortTime as String = "Full date, short time: " +
format('now', dateStyle : Time.FULL,
timeStyle : Time.SHORT)
shortDateFullTime as String = "Short date, full time: " +
format('now', dateStyle : Time.SHORT,
timeStyle : Time.FULL)
display fullDateShortTime + "\n\n" + shortDateFullTime
format
Formats a Time object by applying a specified formatter.
Arguments
Returns
A String containing the representation of the Time object formatted by applying the specified formatter.
Example
display format('now', formatter : DateFormat.getInstance())
format
Formats a Time object with a specified formatter using the provided time zone and locale.
Arguments
Returns
A String containing the representation of the Time object formatted by applying the specified formatter and the time zone and locate provided.
Example
display format('now', formatter : DateFormat.getInstance(),
timeZone : TimeZone.getTimeZone(arg1 : "GMT-10"),
locale : Java.Util.Locale.FRANCE)
format
Formats a Time object with a specified mask.
Arguments
Returns
A String containing the representation of the Time object formatted with the specified mask. The String should be written according to the patterns and rules described below.
The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved):
| Letter | Date or Time Component | Presentation | Example |
|---|---|---|---|
| G | Era designator | Text | AD |
| y | Year | Year | 1996; 96 |
| M | Month in year | Month | July; Jul; 07 |
| w | Week in year | Number | 27 |
| W | Week in month | Number | 2 |
| D | Day in year | Number | 189 |
| d | Day in month | Number | 10 |
| F | Day of week in month | Number | 2 |
| E | Day in week | Text | Tuesday; Tue |
| a | Am/pm marker | Text | PM |
| H | Hour in day (0-23) | Number | 0 |
| k | Hour in day (1-24) | Number | 24 |
| K | Hour in am/pm (0-11) | Number | 0 |
| h | Hour in am/pm (1-12) | Number | 12 |
| m | Minute in hour | Number | 30 |
| s | Second in minute | Number | 55 |
| S | Millisecond | Number | 978 |
| z | Time zone | General time zone | Pacific Standard Time; PST; GMT-08:00 |
| Z | Time zone | RFC 822 time zone | -0800 |
Pattern letters are usually repeated, as their number determines the exact presentation:
Example
display 'now'.format("E dd MM yyyy hh:mm:ss:SS a z")
getDateFormat
Returns an appropriate DateFormat based on the parts needed and a style.
Arguments
Returns
The format based on the required parts and style.
Example
fullDateOnly as String fullDateOnly = "Date only - Full format: " + 'now'.format(Time.getDateFormat( parts : Time.DATE_ONLY, style : Time.FULL)) shortTimeOnly as String shortTimeOnly = "Time only - Short format: " + 'now'.format(Time.getDateFormat( parts : Time.TIME_ONLY, style : Time.SHORT)) longDateTime as String longDateTime = "Date time - Long format: " + 'now'.format(Time.getDateFormat( parts : Time.DATE_TIME, style : Time.FULL)) display fullDateOnly + "\n\n" + shortTimeOnly + "\n\n" + longDateTime
Returns an appropriate DateFormat based on the required parts, style, and locale.
Arguments
Returns
Returns an appropriate DateFormat based on the required parts, style, and locale.
Example
fullDateOnly as String fullDateOnly = "Date only - Full format: " + 'now'.format(Time.getDateFormat( parts : Time.DATE_ONLY, style : Time.FULL, Java.Util.Locale.FRANCE)) shortTimeOnly as String shortTimeOnly = "Time only - Short format: " + 'now'.format(Time.getDateFormat( parts : Time.TIME_ONLY, style : Time.SHORT, Java.Util.Locale.FRANCE)) longDateTime as String longDateTime = "Date time - Long format: " + 'now'.format(Time.getDateFormat( parts : Time.DATE_TIME, style : Time.FULL, Java.Util.Locale.FRANCE)) display fullDateOnly + "\n\n" + shortTimeOnly + "\n\n" + longDateTime
Calculates Easter day for a specified year.
Arguments
Returns
A Time object containing Easter date.
Example
display Time.getEaster(y : 2007)This will show:
Apr 8, 2007 12:00:00 AM
Returns the name of the specified month.
Arguments
Returns
The name of the specified month.
Example
display Time.getMonthName(monthNum : 2)
Returns the name of the specified weekday.
Arguments
Returns
The name of the specified day.
Example
display Time.getWeekdayName(dayNum : 0)
Returns the greater time between two Time objects.
Arguments
Returns
The greater Time object.
Example
manOnMoon as Time manOnMoon = '1969-07-21 02:56:00 -00' display max(manOnMoon, b : 'now')
Returns the smaller Time object between two Time objects.
Arguments
Returns
The smaller Time object.
manOnMoon as Time manOnMoon = '1969-07-21 02:56:00 -00' display min(manOnMoon, b : 'now')
Returns the number of months elapsed since a given Time object.
Arguments
Returns
An Int value with the number of whole months elapsed since the time specified by the Time object to the present time. For example, there are two whole months between January 15 and March 15, but only one whole month between January 15 and March 14.
xMas2007 as Time
xMas2007 = '2007-12-25'
display monthsSince('now', t : xMas2007)
Rounds a Time object to the nearest second.
Arguments
Returns
A Time object with the value of Time rounded to the nearest second.
Example
timeStart as Time time = '2007-04-16 17:21:30.235' display roundToSeconds(timeStart)This displays:
Apr 16, 2007 2:21:30 PM