ALBPM Process API

fuego.lang
Class Time

java.lang.Object
  extended by fuego.lang.Time
All Implemented Interfaces:
Serializable, Comparable

public final class Time
extends Object
implements Comparable, Serializable

Time objects carry a single long that represents the amount of microseconds elapsed since January 1st, 1970 GMT. It is implemented using the Calendar class.

See Also:
Serialized Form

Nested Class Summary
static class Time.Holder
           
 
Field Summary
static int AD
          Field AD
static int BC
          Eras (GregorianCalendar-specific)
static int DATE_ONLY
          Constant for DATE ONLY format
static int DATE_TIME
          Constant for DATE TIME format
static int DEFAULT
          Constant for medium/default style pattern.
static Time EPOCH
          The date used as the "beginning of time" for timestamps.
static int FULL
          Constant for full style pattern.
static int LONG
          Constant for long style pattern.
static Time MAX_VALUE
          Max value of Time allowed
static Time MIN_VALUE
          Min value of Time allowed
static int SHORT
          Constant for short style pattern.
static int TIME_ONLY
          Constant for TIME ONLY format
 
Constructor Summary
Time()
          Constructs a Time object with the current time.
Time(int year, int month, int dayOfMonth)
          Constructs a Time object initialized with the given values for the year, month, and day of month.
 
Method Summary
 Time add(Interval interval)
          Add an Interval to this object.
static Time add(Time time, Interval interval)
          Add a Time and an Interval
 Time addDays(int i)
          Adds days to this time
 Time addHours(long i)
          Adds hours to this time
 Time addMicroSeconds(long i)
          Adds micro-seconds to this time
 Time addMilliSeconds(long i)
          Adds milli-seconds to this time
 Time addMinutes(long i)
          Adds minutes to this time
 Time addMonths(int i)
          Adds months to this time
 Time addSeconds(long i)
          Adds seconds to this time
 Time addWeeks(int weeks)
          Adds weeks to this time
 Time addYears(int i)
          Adds years to this time
 boolean between(Time from, Time to)
          Allows to know if current Time object is between from and to values.
static int compare(Time a, Time b)
          Compares two Times chronologically.
 int compareTo(Object o)
          Compares this Time to another Object.
 int compareTo(Time t)
          Compares two Times chronologically.
 Date dateValue()
          Java's Date that represents this Time
static Time day(Time t, int day)
          Builds a Time object using as base another Time but in the day send as parameter.
 int daysSince(Time t)
          Return number of days between this time and the supplied time.
 boolean equals(Object o)
          Compares this object with an object received as a parameter If the object passed as parameter is not an instance of a Time type or it is equal to null, this method returns false, otherwise it returns the result of the comparison (true or false).
static boolean equals(Time a, Time b)
          Compares two Times for equality.
 String format()
          Formats this date-time with default mask
 String format(DateFormat formatter)
          Formats this date-time with DateFormat using default time zone
 String format(DateFormat formatter, TimeZone timeZone)
          Formats this date-time with DateFormat using provided time zone and locale
 String format(int dateStyle, int timeStyle)
          Formats this date-time with the given date and time formatting styles for the default locale.
 String format(String mask)
          Formats this date-time with given mask Time format syntax: a, am/pm marker, Text, PM d, day in month, Number, 10 D, day in year, Number, 189 E, day in week, Text, Tuesday F, day of week in month, Number, 2 (2nd Wed in July) G, era designator, Text, AD h, hour in am/pm (1~12), Number, 12 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 m, minute in hour, Number, 30 M, month in year, Text & Number, July & 07 s, second in minute, Number, 55 S, millisecond, Number, 978 w, week in year, Number, 27 W, week in month, Number, 2 y, year, Number, 1996 z, time zone, General Time Zone, Pacific Standard Time; PST, GMT-08:00 Z, time zone, RFC 822 time zone, -0800 The count of pattern letters determine the format.
 String format(String mask, TimeZone timeZone)
          Formats this date-time with mask using provided time zone
 String format(String mask, TimeZone timeZone, Locale locale)
          Formats this date-time with mask using provided time zone and locale
static String format(Time time)
          Formats a Time with default mask
 String format(TimeZone timeZone)
          Formats this date-time to the default using the provided time zone
 String format(TimeZone timeZone, Locale locale)
          Formats this date-time using provided time zone and locale The example: display format('now', timeZone : TimeZone.getTimeZone(arg1 : "GMT-10"),     locale : Java.Util.Locale.ITALY) displays : "29-mar-2005 7.25.02", date and time set to Argentina Time zone, but localized to ITALY.
 String formatDate()
          Formats this date with default mask for the default locale.
 String formatDate(int dateStyle)
          Formats this date with the given date formatting style for the default locale.
 String formatGMT(DateFormat formatter)
          Formats this date-time with DateFormat using GMT time zone
 String formatGMT(String mask)
          Formats this date-time with given mask using GMT timezone
 String formatTime(int timeStyle)
          Formats this time with the given time formatting style for the default locale.
 String formatTimeOnly()
          Formats this time as a time only (no TZ correction)
 String formatTimeOnly(int intervalStyle)
          Formats this time as a time only (no TZ correction)
 Time fromGMT()
          Returns the time in the current user Timezone
static Time fromGMT(Time value)
          Returns the time in the current user Timezone
 int getAMPM()
          Returns the AM - PM value.
 String getDate()
          "Date" part of of the Time in the default format locale.
static DateFormat getDateFormat(int parts, int style)
          Returns an appropiate DateFormat based on the time object parts, an style.
static DateFormat getDateFormat(int parts, int style, Locale locale)
          Returns an appropiate DateFormat based on the time object parts, an style and a locale required.
 Time getDatePart()
          Returns a new Time with only the Day,Month,Year parts copied from this instance
 int getDay()
          Return the day of the month, starting from 1
 int getDayOfMonth()
          Return the day of the month, starting from 1
 int getDayOfWeek()
          Return the day of the week
 int getDays()
          Number of the days of this Time.
static Time getEaster(int y)
          Returns the Easter date in the "y" year according to Knuth See also Algorithm from Knuth's "The Art of Programming", Volume 1, pages 168-169
 Time getFirstDayOfMonth()
          Returns a Time object representing the first day of the given Time's month
 int getHour()
          Hour of this Time in 12 hour clock.
 int getHourOfDay()
          Number of Hour of the day.
 int getHours()
          Number of hours of this Time.
 Time getLastDayOfMonth()
          The last day of the given Time's month For example for the Time: "Mar 30, 2005 15:11:16-03", its value is: "Mar 31, 2005 15:11:16-03"
 int getMicroSecond()
          The microsecond value of the Time
 long getMicroSeconds()
          Time represented in number of the microseconds.
 long getMilliSeconds()
          Time represented in number of the milliseconds.
 int getMinute()
          The minute value of the Time
 int getMinutes()
          Time represented in number of the minutes.
 int getMonth()
          The month value of the Time , starting from 1
static String getMonthName(int monthNum)
          Returns a string containing the name of a given month number.
 int getMonths()
          Return the total number of months Since Epoch
 int getSecond()
          The second value of the Time
 int getSeconds()
          Time represented in number of the seconds.
 String getTime()
          Time part of the Time object in DEFAULT style and locale.
 int getTimeOnlyHour()
          Number of hours of this Time
 int getTimeOnlyMicroSecond()
          Microseconds value of this Time
 int getTimeOnlyMinute()
          Number of Minutes of this Time
 int getTimeOnlySecond()
          Seconds value of this time
static TimeZone getTimeZone()
           
static String getWeekdayName(int dayNum)
          Returns a day name for a given day number in a week.
 int getWeekOfMonth()
          Number of Week of the month for this Time
 int getWeekOfYear()
          Number of week of the year for this Time
 int getYear()
          Year value of this Time
 int getYears()
          Return the number of years since Epoch
 int hashCode()
          Returns hash code
static Time hour(Time t, int hour)
           
static Time hourOfDay(Time t, int hour)
           
 int intValue()
          Number of seconds that the time represents since January 1st, 1970.
 boolean isAm()
          Is the Time AM or not? Holds "true": when the time is AM Holds "false": when the time is PM
 Time max(Time b)
          Compares this object with the argument and returns the higher.
 Time min(Time b)
          Compares this object with the argument and returns the lower.
static Time minute(Time t, int minute)
           
static Time month(Time t, int month)
           
 int monthsSince(Time t)
          Return number of months between this time and the given time.
 Time next(fuego.lang.Day day)
           
static Time now()
          Return the system's current time.
static Time nowSeconds()
           
static Time parseFrom(String val)
          the dateFormat of the string is yyyyMMddHHmmssz
static Time parseFrom(String val, String mask)
          the dateFormat of the string is the one specified in the second argument
 String retryAt()
          Deprecated. Maintained for backwards compatibility
 Time roundDownToSeconds()
          Returns the value of this object rounded to seconds
 Time roundToSeconds()
          Returns the value of this object rounded to seconds
static Time second(Time t, int second)
           
static void setLocale(Locale locale)
           
static void setTimeZone(TimeZone tz)
           
 Date sqlDateValue()
          Returns Java SQL's Date representing this object
 Timestamp sqlTimestampValue()
          Returns Java SQL's Timestamp representing this object
 Time sqlTimeValue()
          Returns Java SQL's Time representing this object
 Time sub(Interval interval)
          Subtracts an Interval from the Time object.
 Interval sub(Time that)
          Substracts a given Time to this object.
static Time sub(Time time, Interval interval)
          Substract an Interval from a Time
static Interval sub(Time a, Time b)
          Returns the value of subtraction between the fisrt value with the second one as an Interval object
 String toDateString()
           
 String toDateTimeString()
           
 String toGMonthDayString()
          Returns an XMLSchema gMonthDay string For Example, for the date US locale Mar 30, 2005, it returns "--03-30"
 Time toGMT()
          Returns the time ignoring the current user Timezone
static Time toGMT(Time value)
          Returns the time ignoring the current user Timezone
 String toGYearMonthString()
          Returns an XMLSchema GYearMonth represenation of this Time For Example, for the date US locale Mar 30, 2005, it returns "2005-03"
 String toString()
          Returns an ISO standard string representation of a time value
 Time toTime()
          Returns the Time object
 String toTimeString()
          Returns an XMLSchema Time represenation of this Time
 String toXMLString()
          Returns an ISO standard string representation of a time value
static Time valueOf(BigDecimal microseconds)
          Constructs a Time from a microseconds given value.
static Time valueOf(Calendar calendar)
          Constructs a Time from a calendar
static Time valueOf(Date val)
          Converts to Time from Java's Date class.
static Time valueOf(fuego.lang.Day day, fuego.lang.Week week, fuego.lang.Month month, int year)
          Constructs a Time from day, week, month and year.
static Time valueOf(double microseconds)
          Constructs a Time from a microseconds given value.
static Time valueOf(Interval when)
          Constructs a Time from an interval.
static Time valueOf(int hour, int minute)
          Constructs a time from an hour, minutes
static Time valueOf(int hour, int minute, int second)
          Constructs a time from an hour, minutes & seconds
static Time valueOf(int hour, int minute, int second, int microSecond)
          Constructs a Time from am hour, minutes, seconds & microseconds
static Time valueOf(int year, int month, int dayOfMonth, int hourOfDay, int minute, int second)
          Constructs a Time from year, month, day of month, hour of day, minute & second.
static Time valueOf(int year, int month, int dayOfMonth, int hourOfDay, int minute, int second, int microSecond)
          Constructs a Time from year, month and date.
static Time valueOf(int year, fuego.lang.Month month, int day)
          Constructs a Time from year, month and day.
static Time valueOf(long microseconds)
          Constructs a Time from a microseconds given value.
static Time valueOf(Number value)
           
static Time valueOf(Object value)
           
static Time valueOf(String text)
          Parses a String for a time object.
static Time valueOf(Time val)
          Convert from Java's java.sql.Time class.
static Time valueOf(Timestamp val)
          Converts to Time from Java's java.sql.Timestamp class.
static Time year(Time t, int year)
           
 int yearsSince(Time t)
          Return number of years between
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BC

public static final int BC
Eras (GregorianCalendar-specific)

See Also:
Constant Field Values

AD

public static final int AD
Field AD

See Also:
Constant Field Values

FULL

public static final int FULL
Constant for full style pattern.

See Also:
Constant Field Values

LONG

public static final int LONG
Constant for long style pattern.

See Also:
Constant Field Values

DEFAULT

public static final int DEFAULT
Constant for medium/default style pattern.

See Also:
Constant Field Values

SHORT

public static final int SHORT
Constant for short style pattern.

See Also:
Constant Field Values

DATE_ONLY

public static final int DATE_ONLY
Constant for DATE ONLY format

See Also:
Constant Field Values

TIME_ONLY

public static final int TIME_ONLY
Constant for TIME ONLY format

See Also:
Constant Field Values

DATE_TIME

public static final int DATE_TIME
Constant for DATE TIME format

See Also:
Constant Field Values

MAX_VALUE

public static final Time MAX_VALUE
Max value of Time allowed


MIN_VALUE

public static final Time MIN_VALUE
Min value of Time allowed


EPOCH

public static final Time EPOCH
The date used as the "beginning of time" for timestamps. Time values in Unix systems are represented as seconds since the epoch, with library functions available for converting these values into standard date and time formats. The epoch on Unix and POSIX systems is 1970-01-01 00:00:00 UTC.

Constructor Detail

Time

public Time()
Constructs a Time object with the current time.


Time

public Time(int year,
            int month,
            int dayOfMonth)
Constructs a Time object initialized with the given values for the year, month, and day of month. If you give a wrong ending day to the month, it sets the first day of the following month. For example in: d1 as Time d1 = Time(2005,11,31) "d1" will hold the date : 2005/12/1

Parameters:
year -
month: - must be between 1 to 12
dayOfMonth: - must be between 1 to 31
Method Detail

add

public static Time add(Time time,
                       Interval interval)
Add a Time and an Interval

Parameters:
time - to add.
interval - to add.
Returns:
the result of the operation.

compare

public static int compare(Time a,
                          Time b)
Compares two Times chronologically. The method returns: - the value 0 if the Time "a" is equal to the Time "b", - a value less than 0 if the Time "b" is previous chronologically to "a", - a value greater than 0 otherwise. If one of the parameters is null, it will be considered lesser than the other

Parameters:
a - Time first Time to be compared.
b - Time second Time to be compared.
Returns:
- the value 0 if the Time "a" is equal to the Time "b", - a value less than 0 if the Time "b" is previous chronologically to "a", - a value greater than 0 otherwise. If one of the parameters is null, it will be considered lesser than the other

day

public static Time day(Time t,
                       int day)
Builds a Time object using as base another Time but in the day send as parameter. For Example: d1 = Time(2005,12,31) d2 = Time.day(d1, 5) sets in d2 the "12/5/2005"

Parameters:
t - Time a Time object used as base to build the new one.
day - int the day to change in t.

equals

public static boolean equals(Time a,
                             Time b)
Compares two Times for equality.

Parameters:
a - Time first Time to be compared.
b - Time second Time to be compared.
Returns:
the result of the comparison (true or false).

format

public static String format(Time time)
Formats a Time with default mask

Parameters:
time - Time Time to be formatted
Returns:
The string with the formatted output

fromGMT

public static Time fromGMT(Time value)
Returns the time in the current user Timezone

Returns:
the time in the current user Timezone

getDateFormat

public static DateFormat getDateFormat(int parts,
                                       int style)
Returns an appropiate DateFormat based on the time object parts, an style. This DateFormat obtained can be used to format another Time object using the format method. Possible Time parts to get the format: DATE_ONLY, TIME_ONLY, DATE_TIME Possible styles : SHORT, DEFAULT, LONG, FULL

Parameters:
parts - : Time object parts to include in the formatter to obtain
style - : Style to apply to the formatter

getDateFormat

public static DateFormat getDateFormat(int parts,
                                       int style,
                                       Locale locale)
Returns an appropiate DateFormat based on the time object parts, an style and a locale required. This DateFormat obtained can be used to format another Time object using the format method. For example, in the following FBL:
formatter as DateFormat formatter = d1.getDateFormat(parts : Time.DATE_TIME, style : Time.FULL,         locale : Java.Util.Locale.FRANCE)
a formatter is obtained localized to France, that includes both the "date" and "time" parts of the Time object and that has the FULL style. If this formatter is applied to the same "d1" Time object it would be format as follows: Value formatted to default US locale: Mar 30, 2005 2:22:02 PM (d1.format(dateStyle: Time.DEFAULT, timeStyle : Time.DEFAULT)) Value formatted using the obtained "formatter": mercredi 30 mars 2005 14 h 22 GMt-03:00 Possible Time parts to get the format: DATE_ONLY, TIME_ONLY, DATE_TIME Possible styles : SHORT, DEFAULT, LONG, FULL

Parameters:
parts - : Time object parts to include in the formatter to obtaine
style - : Style to apply to the formatter
locale - : the locale used

getEaster

public static Time getEaster(int y)
Returns the Easter date in the "y" year according to Knuth See also Algorithm from Knuth's "The Art of Programming", Volume 1, pages 168-169

Parameters:
y - The year.

getMonthName

public static String getMonthName(int monthNum)
Returns a string containing the name of a given month number.

Parameters:
monthNum - the number of the month
Returns:
the name of the month binded with the number.

getWeekdayName

public static String getWeekdayName(int dayNum)
Returns a day name for a given day number in a week. For example:
display Time.getWeekdayName(4)
displays "Thursday"

Parameters:
dayNum -
Returns:
the name of the day binded with the given number.

hour

public static Time hour(Time t,
                        int hour)

hourOfDay

public static Time hourOfDay(Time t,
                             int hour)

minute

public static Time minute(Time t,
                          int minute)

month

public static Time month(Time t,
                         int month)

now

public static Time now()
Return the system's current time.


nowSeconds

public static Time nowSeconds()

parseFrom

public static Time parseFrom(String val)
the dateFormat of the string is yyyyMMddHHmmssz

Parameters:
val - the string in the predefined format
Returns:
the Time represented by the string , or null if the string do not represent a time
See Also:
time format

parseFrom

public static Time parseFrom(String val,
                             @NonNls
                             String mask)
the dateFormat of the string is the one specified in the second argument

Parameters:
val - the string in the predefined format
Returns:
the Time represented by the string , or null if the string do not represent a time
See Also:
time format

second

public static Time second(Time t,
                          int second)

setLocale

public static void setLocale(Locale locale)

setTimeZone

public static void setTimeZone(TimeZone tz)

getTimeZone

public static TimeZone getTimeZone()

sub

public static Interval sub(Time a,
                           Time b)
Returns the value of subtraction between the fisrt value with the second one as an Interval object

Parameters:
a - First Time object.
b - Second Time object.

sub

public static Time sub(Time time,
                       Interval interval)
Substract an Interval from a Time

Parameters:
time - to substract from
interval - to substract
Returns:
the result of the operation.

toGMT

public static Time toGMT(Time value)
Returns the time ignoring the current user Timezone

Returns:
the time ignoring the current user Timezone

valueOf

public static Time valueOf(BigDecimal microseconds)
Constructs a Time from a microseconds given value.

Parameters:
microseconds - microseconds

valueOf

public static Time valueOf(double microseconds)
Constructs a Time from a microseconds given value.

Parameters:
microseconds - microseconds

valueOf

public static Time valueOf(long microseconds)
Constructs a Time from a microseconds given value.

Parameters:
microseconds - microseconds

valueOf

public static Time valueOf(Calendar calendar)
Constructs a Time from a calendar

Parameters:
calendar - Calendar

valueOf

public static Time valueOf(String text)
                    throws fuego.lang.FormatException
Parses a String for a time object. The string can have one of the following formats (using lex-like syntax): 1. Date-time specification: -?y{1,6}/M{1,2}/d{1,2}( h{1,2}:m{1,2}(:s{1,2}(.ms)?)?)? In this case, if years are positive (AD), more than three digits must be specified (use leading zeroes to pad if necessary). 2. Time-only specification h{1,2}:m{1,2}(:s{1,2}(.ms{1,})?)?)? 3. Interval specification -?{num}d{num}h{num}m{num}s(.ms)? With d, h, m and s specification in any order In cases 2. and 3., no timezone correction is applied to the resulting Time object. The resulting Time objects can therefore be used to be added to a date-time Time.

Parameters:
text - The string from which the time object should be parsed.
Returns:
A Time object representing the given date/time.
Throws:
fuego.lang.FormatException
FormatException

valueOf

public static Time valueOf(Date val)
Converts to Time from Java's Date class.

Parameters:
val - Date from which to initialize this Time object.

valueOf

public static Time valueOf(Time val)
Convert from Java's java.sql.Time class.

Parameters:
val - Date from which to initialize this Time object.

valueOf

public static Time valueOf(Timestamp val)
Converts to Time from Java's java.sql.Timestamp class.

Parameters:
val - Date from which to initialize this Time object.

valueOf

public static Time valueOf(Interval when)
Constructs a Time from an interval.

Parameters:
when - Interval

valueOf

public static Time valueOf(Object value)

valueOf

public static Time valueOf(Number value)

valueOf

public static Time valueOf(int hour,
                           int minute)
                    throws IllegalArgumentException
Constructs a time from an hour, minutes

Parameters:
hour - The hour, from 0 to 24 (24 == 0 of the next day).
minute - The minute, from 0 to 59.
Throws:
IllegalArgumentException

valueOf

public static Time valueOf(int hour,
                           int minute,
                           int second)
                    throws IllegalArgumentException
Constructs a time from an hour, minutes & seconds

Parameters:
hour - The hour, from 0 to 24 (24 == 0 of the next day).
minute - The minute, from 0 to 59.
second - The second, from 0 to 59.
Throws:
IllegalArgumentException

valueOf

public static Time valueOf(int year,
                           fuego.lang.Month month,
                           int day)
Constructs a Time from year, month and day.

Parameters:
year - The year, complete with century, like it should be!.
month - The month, starting from 1, like it should be!.
day - The day of the month, starting from 1.

valueOf

public static Time valueOf(int hour,
                           int minute,
                           int second,
                           int microSecond)
                    throws IllegalArgumentException
Constructs a Time from am hour, minutes, seconds & microseconds

Parameters:
hour - The hour, from 0 to 24 (24 == 0 of the next day).
minute - The minute, from 0 to 59.
second - The second, from 0 to 59.
second - The micro second, from 0 to 999999.
microSecond -
Throws:
IllegalArgumentException

valueOf

public static Time valueOf(fuego.lang.Day day,
                           fuego.lang.Week week,
                           fuego.lang.Month month,
                           int year)
Constructs a Time from day, week, month and year.

Parameters:
day - The day of the month, starting from 1.
week - The day of the month, starting from 1.
month - The month, starting from 1, like it should be!.
year - The year, complete with century, like it should be!.

valueOf

public static Time valueOf(int year,
                           int month,
                           int dayOfMonth,
                           int hourOfDay,
                           int minute,
                           int second)
                    throws IllegalArgumentException
Constructs a Time from year, month, day of month, hour of day, minute & second.

Parameters:
year - The year, complete with century, like it should be!.
month - The month, starting from 1, like it should be!.
dayOfMonth - The day of the month, starting from 1.
hourOfDay - The hour, from 0 to 24 (24 == 0 of the next day).
minute - The minute, from 0 to 59.
second - The second, from 0 to 59.
Throws:
IllegalArgumentException

valueOf

public static Time valueOf(int year,
                           int month,
                           int dayOfMonth,
                           int hourOfDay,
                           int minute,
                           int second,
                           int microSecond)
                    throws IllegalArgumentException
Constructs a Time from year, month and date.

Parameters:
year - The year, complete with century, like it should be!.
month - The month, starting from 1, like it should be!.
dayOfMonth - The day of the month, starting from 1.
hourOfDay -
minute -
second -
microSecond -
Throws:
IllegalArgumentException

year

public static Time year(Time t,
                        int year)

getDatePart

public Time getDatePart()
Returns a new Time with only the Day,Month,Year parts copied from this instance

Returns:
The same Time but with date part only

add

public Time add(Interval interval)
Add an Interval to this object.

Parameters:
interval - to add.
Returns:
the result of the operation.

addDays

public Time addDays(int i)
Adds days to this time

Parameters:
i - Days to add (can be negative)

addHours

public Time addHours(long i)
Adds hours to this time

Parameters:
i - Hours to add (can be negative)

addMicroSeconds

public Time addMicroSeconds(long i)
Adds micro-seconds to this time

Parameters:
i - Micro-seconds to add (can be negative)

addMilliSeconds

public Time addMilliSeconds(long i)
Adds milli-seconds to this time

Parameters:
i - Milli-seconds to add (can be negative)

addMinutes

public Time addMinutes(long i)
Adds minutes to this time

Parameters:
i - Minutes to add (can be negative)

addMonths

public Time addMonths(int i)
Adds months to this time

Parameters:
i - Months to add (can be negative)

addSeconds

public Time addSeconds(long i)
Adds seconds to this time

Parameters:
i - Seconds to add (can be negative)

addWeeks

public Time addWeeks(int weeks)
Adds weeks to this time

Parameters:
weeks - Weeks to add (can be negative)

addYears

public Time addYears(int i)
Adds years to this time

Parameters:
i - Years to add (can be negative)

between

public boolean between(Time from,
                       Time to)
Allows to know if current Time object is between from and to values.

Parameters:
from - Value from (included)
to - Value to (included)

compareTo

public int compareTo(Object o)
Compares this Time to another Object. If the Object is a Time, this function behaves like compareTo(Time). Otherwise, it throws a ClassCastException (as Times are comparable only to other Times). It returns: - the value 0 if the argument Time is equal to this Time; - a value less than 0 if this Time is previous chronologically to argument; - and a value greater than 0 otherwise.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
- the value 0 if the argument Time is equal to this Time; - a value less than 0 if this Time is previous chronologically to argument; - and a value greater than 0 otherwise.
Throws:
ClassCastException - if the argument is not a Time.
Since:
JDK1.2

compareTo

public int compareTo(Time t)
Compares two Times chronologically. It returns: - the value 0 if the argument Time is equal to this Time; - a value less than 0 if this Time is previous chronologically to argument; - and a value greater than 0 otherwise.

Parameters:
t - the Time to be compared.
Returns:
- the value 0 if the argument Time is equal to this Time; - a value less than 0 if this Time is previous chronologically to argument; - and a value greater than 0 otherwise.

dateValue

public Date dateValue()
Java's Date that represents this Time

Returns:
Java's Date representing this date

daysSince

public int daysSince(Time t)
Return number of days between this time and the supplied time.

Parameters:
t - The time to compare this to.
Returns:
The number of days between the two dates.

equals

public boolean equals(Object o)
Compares this object with an object received as a parameter If the object passed as parameter is not an instance of a Time type or it is equal to null, this method returns false, otherwise it returns the result of the comparison (true or false).

Overrides:
equals in class Object
Parameters:
o - an object to compare to.
Returns:
If the parameter object is not an instance of a Time type or is equal to null, this method returns false, otherwise it returns the result of the comparison (true or false).

format

public String format()
Formats this date-time with default mask

Returns:
The string with the formatted output

format

public String format(DateFormat formatter)
Formats this date-time with DateFormat using default time zone

Parameters:
formatter -
Returns:
The string with the formatted output

format

public String format(TimeZone timeZone)
Formats this date-time to the default using the provided time zone

Parameters:
timeZone -
Returns:
The string with the formatted output

format

public String format(String mask)
Formats this date-time with given mask Time format syntax: a, am/pm marker, Text, PM d, day in month, Number, 10 D, day in year, Number, 189 E, day in week, Text, Tuesday F, day of week in month, Number, 2 (2nd Wed in July) G, era designator, Text, AD h, hour in am/pm (1~12), Number, 12 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 m, minute in hour, Number, 30 M, month in year, Text & Number, July & 07 s, second in minute, Number, 55 S, millisecond, Number, 978 w, week in year, Number, 27 W, week in month, Number, 2 y, year, Number, 1996 z, time zone, General Time Zone, Pacific Standard Time; PST, GMT-08:00 Z, time zone, RFC 822 time zone, -0800 The count of pattern letters determine the format. Text: 4 or more, use full form, <4, use short or abbreviated form if exists. Number: the minimum number of digits. Shorter numbers are zero-padded to this amount. Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits. Text & Number: 3 or over, use text, otherwise use number. Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes. A pattern containing any invalid pattern letter will result in an exception to be thrown during formatting or parsing. Examples using the US locale: "yyyy.MM.dd G 'at' hh:mm:ss z" ->> 1996.07.10 AD at 15:08:56 PDT "EEE, MMM d, ''yy" ->> Wed, July 10, '96 "h:mm a" ->> 12:08 PM "hh 'o''''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time "K:mm a, z" ->> 0:00 PM, PST "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 1996.July.10 AD 12:08 PM

Parameters:
mask - Mask
Returns:
The string with the formatted output

format

public String format(TimeZone timeZone,
                     Locale locale)
Formats this date-time using provided time zone and locale The example:
display format('now', timeZone : TimeZone.getTimeZone(arg1 : "GMT-10"),     locale : Java.Util.Locale.ITALY)
displays : "29-mar-2005 7.25.02", date and time set to Argentina Time zone, but localized to ITALY. The example:
display format('now', timeZone : TimeZone.getTimeZone(arg1 : "GMT-10"),     locale : Java.Util.Locale.FRANCE)
displays: "29 mars 2005 07:25:53", date and time set to Argentine Time zone, but localized to FRANCE.

Parameters:
timeZone -
locale -
Returns:
The string with the formatted output

format

public String format(String mask,
                     TimeZone timeZone)
Formats this date-time with mask using provided time zone

Parameters:
mask -
timeZone -
Returns:
The string with the formatted output

format

public String format(int dateStyle,
                     int timeStyle)
Formats this date-time with the given date and time formatting styles for the default locale. Available styles for date and time are: DEFAULT, FULL, LONG, SHORT For example, for US locale: display d1.format(dateStyle: Time.FULL, timeStyle : Time.LONG) shows: "Tuesday, March 29, 2005 2:10:19 PM ART"

Parameters:
dateStyle - the given date formatting style.
timeStyle - the given time formatting style.
Returns:
The string with the formatted output

format

public String format(DateFormat formatter,
                     TimeZone timeZone)
Formats this date-time with DateFormat using provided time zone and locale

Parameters:
formatter -
timeZone -
Returns:
The string with the formatted output

format

public String format(String mask,
                     TimeZone timeZone,
                     Locale locale)
Formats this date-time with mask using provided time zone and locale

Parameters:
mask -
timeZone -
locale -
Returns:
The string with the formatted output

formatDate

public String formatDate()
Formats this date with default mask for the default locale. Returns a String containing the representation of the Time object formatted with the default mask. For US locale it is: "Mar 29, 2005"

Returns:
The string with the formatted output

formatDate

public String formatDate(int dateStyle)
Formats this date with the given date formatting style for the default locale. Available date styles are, DEFAULT, FULL, LONG, SHORT Some examples, for US locale: - DEFAULT: "Mar 29, 2005" - SHORT ("M/d/yy"): "3/29/05" - LONG: "March 29, 2005" - FULL: "Tuesday, March 29, 2005"

Parameters:
dateStyle - the given date formatting style.
Returns:
The string with the formatted output

formatGMT

public String formatGMT(DateFormat formatter)
Formats this date-time with DateFormat using GMT time zone

Parameters:
formatter -
Returns:
The string with the formatted output

formatGMT

public String formatGMT(String mask)
Formats this date-time with given mask using GMT timezone

Parameters:
mask - Mask
Returns:
The string with the formatted output

formatTime

public String formatTime(int timeStyle)
Formats this time with the given time formatting style for the default locale.

Parameters:
timeStyle - the given time formatting style. For example, SHORT for "h:mm a" in the US locale.
Returns:
The string with the formatted output

formatTimeOnly

public String formatTimeOnly()
Formats this time as a time only (no TZ correction)

Returns:
The string with the formatted output

formatTimeOnly

public String formatTimeOnly(int intervalStyle)
Formats this time as a time only (no TZ correction)

Parameters:
intervalStyle - The style with which to format the time
Returns:
The string with the formatted output

fromGMT

public Time fromGMT()
Returns the time in the current user Timezone

Returns:
the time in the current user Timezone

getAMPM

public int getAMPM()
Returns the AM - PM value.


getDate

public String getDate()
"Date" part of of the Time in the default format locale. For example, for US locale: "Mar 29, 2005"

Returns:
The string with the formatted output

getDay

public int getDay()
Return the day of the month, starting from 1


getDayOfMonth

public int getDayOfMonth()
Return the day of the month, starting from 1


getDayOfWeek

public int getDayOfWeek()
Return the day of the week


getDays

public int getDays()
Number of the days of this Time.


getFirstDayOfMonth

public Time getFirstDayOfMonth()
Returns a Time object representing the first day of the given Time's month

Returns:
A Time object representing the first day of the given Time's month

getHour

public int getHour()
Hour of this Time in 12 hour clock.


getHourOfDay

public int getHourOfDay()
Number of Hour of the day. If the Time is between 3:00 PM and 4:00 PM, this attribute holds the number "15".


getHours

public int getHours()
Number of hours of this Time.


getLastDayOfMonth

public Time getLastDayOfMonth()
The last day of the given Time's month For example for the Time: "Mar 30, 2005 15:11:16-03", its value is: "Mar 31, 2005 15:11:16-03"

Returns:
A Time object representing the last day of the given Time's month

getMicroSecond

public int getMicroSecond()
The microsecond value of the Time


getMicroSeconds

public long getMicroSeconds()
Time represented in number of the microseconds.


getMilliSeconds

public long getMilliSeconds()
Time represented in number of the milliseconds.


getMinute

public int getMinute()
The minute value of the Time


getMinutes

public int getMinutes()
Time represented in number of the minutes.


getMonth

public int getMonth()
The month value of the Time , starting from 1


getMonths

public int getMonths()
Return the total number of months Since Epoch


getYears

public int getYears()
Return the number of years since Epoch


getSecond

public int getSecond()
The second value of the Time


getSeconds

public int getSeconds()
Time represented in number of the seconds.


getTime

public String getTime()
Time part of the Time object in DEFAULT style and locale.

Returns:
The string with the formatted output

getTimeOnlyHour

public int getTimeOnlyHour()
Number of hours of this Time

Returns:
Hour value of this object

getTimeOnlyMicroSecond

public int getTimeOnlyMicroSecond()
Microseconds value of this Time

Returns:
Micro Second value of this object

getTimeOnlyMinute

public int getTimeOnlyMinute()
Number of Minutes of this Time

Returns:
Minute value of this object

getTimeOnlySecond

public int getTimeOnlySecond()
Seconds value of this time

Returns:
Second value of this object

getWeekOfMonth

public int getWeekOfMonth()
Number of Week of the month for this Time

Returns:
Week of month value of this object

getWeekOfYear

public int getWeekOfYear()
Number of week of the year for this Time


getYear

public int getYear()
Year value of this Time


hashCode

public int hashCode()
Returns hash code

Overrides:
hashCode in class Object

intValue

public int intValue()
Number of seconds that the time represents since January 1st, 1970.

Returns:
Number of seconds since January 1st, 1970.

isAm

public boolean isAm()
Is the Time AM or not? Holds "true": when the time is AM Holds "false": when the time is PM

Returns:

max

public Time max(Time b)
Compares this object with the argument and returns the higher.

Parameters:
b - Time The argument to compare with this object
Returns:

min

public Time min(Time b)
Compares this object with the argument and returns the lower.

Parameters:
b - Time The argument to compare with this object
Returns:

monthsSince

public int monthsSince(Time t)
Return number of months between this time and the given time.

Parameters:
t - The time to compare this to.
Returns:
The number of months between the two dates.

next

public Time next(fuego.lang.Day day)

retryAt

@Deprecated
public String retryAt()
Deprecated. Maintained for backwards compatibility

This method has been deprecated, it is maintained for backwards compatibility.

Returns:
a result for global automatic polling activities

roundDownToSeconds

public Time roundDownToSeconds()
Returns the value of this object rounded to seconds


roundToSeconds

public Time roundToSeconds()
Returns the value of this object rounded to seconds


sqlDateValue

public Date sqlDateValue()
Returns Java SQL's Date representing this object

Returns:
Java SQL's Date representing this date

sqlTimestampValue

public Timestamp sqlTimestampValue()
Returns Java SQL's Timestamp representing this object

Returns:
Java SQL's Timestamp representing this date

sqlTimeValue

public Time sqlTimeValue()
Returns Java SQL's Time representing this object

Returns:
Java SQL's Time representing this date

sub

public Interval sub(Time that)
Substracts a given Time to this object.

Parameters:
that - the time to substract.
Returns:
the result of the operation.

sub

public Time sub(Interval interval)
Subtracts an Interval from the Time object.

Parameters:
interval - to subtract.
Returns:
the result of the operation.

toDateString

public String toDateString()
Returns:
String valid for XSD date

toDateTimeString

public String toDateTimeString()
Returns:
String valid for XSD datetime

toGMonthDayString

public String toGMonthDayString()
Returns an XMLSchema gMonthDay string For Example, for the date US locale Mar 30, 2005, it returns "--03-30"


toGMT

public Time toGMT()
Returns the time ignoring the current user Timezone

Returns:
the time ignoring the current user Timezone

toGYearMonthString

public String toGYearMonthString()
Returns an XMLSchema GYearMonth represenation of this Time For Example, for the date US locale Mar 30, 2005, it returns "2005-03"


toString

public String toString()
Returns an ISO standard string representation of a time value

Overrides:
toString in class Object

toTime

public Time toTime()
Returns the Time object

Returns:
the Time object

toTimeString

public String toTimeString()
Returns an XMLSchema Time represenation of this Time


toXMLString

public String toXMLString()
Returns an ISO standard string representation of a time value


yearsSince

public int yearsSince(Time t)
Return number of years between

this time and the given time.

Parameters:
t - The time to compare this to.
Returns:
The number of years between the two dates.

ALBPM Process API

© Copyright 1996/2005 Fuego Inc. All Rights Reserved