Imp
[using it]
Interface Manipulation Package v4.0 (2008-06-25) a-projector ©copyright Author


imp.core
Class Time

java.lang.Object
  extended by imp.core.Value
      extended by imp.core.Time
All Implemented Interfaces:
Cloneable, Comparable<Value>

public class Time
extends Value

Implements a date/time value.

Here, dates / times are represented by a string with the following format:
$year-$month-$day $hour-$minute-$second
(where the characters -, and : stand for themselves). By default, values correspond to ``now'', i.e. the current date/time when the date is created.
Using locale-specific syntax. The previous syntax is the canonical definition of dates. However, locale specific syntax can be parsed/shown when entering/rendering a date.
Using the Gregorian calendar. The standard (Gregorian) calendar is used: it has 2 eras, BC and AD and a single discontinuity, which corresponds to the date the Gregorian calendar was instituted (October 15, 1582 in main countries). Historically, in those countries which adopted the Gregorian calendar first, October 4, 1582 was thus followed by October 15, 1582. Before the Gregorian cut-over, GregorianCalendar implements the Julian calendar. The only difference between the Gregorian and the Julian calendar is the leap year rule. The Julian calendar specifies leap years every four years, whereas the Gregorian calendar omits century years which are not divisible by 400.
Dates are computed by extrapolating the current rules indefinitely far backward and forward in time. As a result, GregorianCalendar may be used for all years to generate meaningful and consistent results. However, dates obtained using GregorianCalendar are historically accurate only from March 1, 4 AD onward, when modern Julian calendar rules were adopted. Before this date, leap year rules were applied irregularly, and before 45 BC the Julian calendar did not even exist. Prior to the institution of the Gregorian calendar, New Year's Day was March 25 but to avoid confusion, this calendar always uses January 1.


Field Summary
 
Fields inherited from class imp.core.Value
NULL
 
Method Summary
 int getDay()
          Gets the date day of month.
 int getHour()
          Gets the time hour of day.
 int getMinute()
          Gets the time minute.
 int getMonth()
          Gets the date month.
 int getSecond()
          Gets the time second.
 long getValue()
          Gets the date/time value.
 int getWeekDay()
          Gets the date day of week.
 int getYear()
          Gets the date year.
 Time setFormat(String format)
          Sets the date/time format and return this.
 Time setLocalization(String localization)
          Sets the date/time localization and return this.
 Time setValue(String time, boolean standard)
          Sets the date/time from the string and return this.
 
Methods inherited from class imp.core.Value
add, cloneThis, create, elements, fields, get, getType, getWrapping, isCyclic, isName, length, load, main, save, set, toString, wrappedObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getDay

public int getDay()
Gets the date day of month.


getHour

public int getHour()
Gets the time hour of day.


getMinute

public int getMinute()
Gets the time minute.


getMonth

public int getMonth()
Gets the date month.


getSecond

public int getSecond()
Gets the time second.


getValue

public long getValue()
Gets the date/time value.

Returns:
The date/time as the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

getWeekDay

public int getWeekDay()
Gets the date day of week.


getYear

public int getYear()
Gets the date year.


setFormat

public Time setFormat(String format)
Sets the date/time format and return this.

Parameters:
format - [optional, default is date-time:standard] A string of the form date:verbosity, time:verbosity or date-time:verbosity where verbosity defines the string representation, either standard, numeric, short, long, full.

setLocalization

public Time setLocalization(String localization)
Sets the date/time localization and return this.

Parameters:
localization - [optional, default is null for default locale] A string of the form language_country:zone, language_country, language:zone, language or :zone (e.g. en_US:America/Chicago) where the
The language is a lowercase two-letter ISO-639 code.
The country is an uppercase two-letter ISO-3166 code.
The zone is either a time-zone abbreviation such as "PST", or a full name such as "America/Chicago", or a custom ID such as "GMT-8:00".
Unspecified aspects are set to the current system defaults.

setValue

public Time setValue(String time,
                     boolean standard)
Sets the date/time from the string and return this.

Parameters:
time - The date/time value using the locale format.
As long:
The date/time as the difference, measured in milliseconds, since midnight, January 1, 1970 UTC.
standard - [optional, default is false] If true uses the standard format to set the value.