org.norther.tammi.acorn.lang
Class StringDate

java.lang.Object
  extended by org.norther.tammi.acorn.lang.StringDate
All Implemented Interfaces:
Serializable, CharSequence

public class StringDate
extends Object
implements CharSequence, Serializable

A string representation of date in ISO-8601 format.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static int DATE_MASK
          The date mask.
static int DATE_TIME_MASK
          The void mask.
static int TIME_MASK
          The time mask.
 
Constructor Summary
StringDate(CharSequence date)
          Constructs a new date from a string in ISO-8601 format.
StringDate(Date date)
          Constructs a new date from java.util.Date.
StringDate(int y, int m, int d, int hh, int mm, int ss, int mask)
          Constructs a new date from date items.
 
Method Summary
 char charAt(int index)
           
 int getDay()
          Gets the day.
 int getHour()
          Gets the hour.
 int getMinute()
          Gets the minute.
 int getMonth()
          Gets the month.
 int getRelativeMask()
          Gets the mask of relative date items.
 int getSecond()
          Gets the second.
 int getYear()
          Gets the year.
 int length()
           
 CharSequence subSequence(int start, int end)
           
 Date toDate(Calendar calendar)
          Returns a date represention.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATE_MASK

public static final int DATE_MASK
The date mask.

See Also:
Constant Field Values

TIME_MASK

public static final int TIME_MASK
The time mask.

See Also:
Constant Field Values

DATE_TIME_MASK

public static final int DATE_TIME_MASK
The void mask.

See Also:
Constant Field Values
Constructor Detail

StringDate

public StringDate(CharSequence date)
Constructs a new date from a string in ISO-8601 format.

Parameters:
date - the string.

StringDate

public StringDate(Date date)
Constructs a new date from java.util.Date.

Parameters:
date - the date.

StringDate

public StringDate(int y,
                  int m,
                  int d,
                  int hh,
                  int mm,
                  int ss,
                  int mask)
Constructs a new date from date items.

Parameters:
y - the year.
m - the month.
d - the day.
hh - the hour.
mm - the minute.
ss - the second.
mask - the relative items mask.
Method Detail

length

public int length()
Specified by:
length in interface CharSequence

charAt

public char charAt(int index)
Specified by:
charAt in interface CharSequence

subSequence

public CharSequence subSequence(int start,
                                int end)
Specified by:
subSequence in interface CharSequence

toString

public String toString()
Specified by:
toString in interface CharSequence
Overrides:
toString in class Object

getYear

public int getYear()
Gets the year.

Returns:
the year.

getMonth

public int getMonth()
Gets the month.

Returns:
the month.

getDay

public int getDay()
Gets the day.

Returns:
the day.

getHour

public int getHour()
Gets the hour.

Returns:
the hour.

getMinute

public int getMinute()
Gets the minute.

Returns:
the minute.

getSecond

public int getSecond()
Gets the second.

Returns:
the second.

getRelativeMask

public int getRelativeMask()
Gets the mask of relative date items.

Returns:
the relative items mask.

toDate

public Date toDate(Calendar calendar)
Returns a date represention.

Parameters:
calendar - the calendar to apply.
Returns:
the date instance.


Copyright © 2004 The Norther Organization. All rights reserved.