Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.tripi.asp
Class AspDate  view AspDate download AspDate.java

java.lang.Object
  extended bycom.tripi.asp.AspDate

public class AspDate
extends java.lang.Object

The AspDate class contains the special code needed for handling ASP dates. This class can process most date format, and can be configured for the default month, day, year ordering.

Version:
0.9

Field Summary
(package private) static int AMPM
          AM/PM bit field
protected  java.util.Calendar cal
          The current date/time values as a calendar object
(package private) static int DAY
          Day bit field
private static org.apache.log4j.Category DBG
          Debugging class
protected  boolean hasDate
          Does this object hold a date value?
protected  boolean hasTime
          Does this object hold a time value?
(package private) static java.text.DateFormat longDateFormat
          Long date format
(package private) static java.text.DateFormat longDateTimeFormat
          Long date/time format
(package private) static java.text.DateFormat longTimeFormat
          Long time format
(package private) static int MONTH
          Month bit field
protected static java.lang.String order
          Field contains the current default order of the month, day, year fields
(package private) static java.text.DateFormat shortDateFormat
          Short date format
(package private) static java.text.DateFormat shortTimeFormat
          Short time format
(package private) static int TIME
          Time bit field
(package private) static int YEAR
          Year bit field
 
Constructor Summary
  AspDate(java.util.Calendar cal)
          This constructor creates an AspDate object from a Java calendar object.
  AspDate(java.util.Calendar javaCal, boolean hasTime, boolean hasDate)
          This constructor creates an AspDate object from a Java Calendar object, optionally setting the date and time values.
  AspDate(java.util.Date date)
          This constructor creates an AspDate object from a Java Date object.
  AspDate(java.util.Date javaDate, boolean hasTime, boolean hasDate)
          This constructor creates an AspDate object from a Java Date object, optionally setting the date and time values.
protected AspDate(int month, int day, int year)
          Constructor set with specific date-only settings.
protected AspDate(int month, int day, int year, int hour, int minute, int second)
          Constructor set with specific time settings.
  AspDate(java.lang.String datestr)
          This constructor creates an AspDate object from a generic time string.
 
Method Summary
 int getDay()
          Get the day value of this AspDate
 int getHour()
          Get the hour value of this AspDate
 int getMinute()
          Get the minute value of this AspDate
 int getMonth()
          Get the month value of this AspDate
private static int getMonthString(java.lang.String str)
          This funtion obtains from a string, the month the string corresponds to.
 int getSecond()
          Get the second value of this AspDate
 int getYear()
          Get the year value of this AspDate
 boolean hasDate()
          Does this object have a date value?
 boolean hasTime()
          Does this object have a time value?
private static boolean isNumber(java.lang.String str)
          This function determines if the specified string contains a number
static boolean isTimeString(java.lang.String str)
          This function attempts to determine if the given string is a time string.
protected  void parseTime(java.lang.String str)
          This function parses the given string into hour, minute, second, and sets the internal variables accordingly.
 java.util.Calendar toCalendar()
          Converts this AspDate object to a Calendar object
 java.util.Date toDate()
          Converts this AspDate object to a Date object
 java.lang.String toString()
          Convert this date to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DBG

private static final org.apache.log4j.Category DBG
Debugging class


MONTH

static final int MONTH
Month bit field

See Also:
Constant Field Values

DAY

static final int DAY
Day bit field

See Also:
Constant Field Values

YEAR

static final int YEAR
Year bit field

See Also:
Constant Field Values

TIME

static final int TIME
Time bit field

See Also:
Constant Field Values

AMPM

static final int AMPM
AM/PM bit field

See Also:
Constant Field Values

order

protected static java.lang.String order
Field contains the current default order of the month, day, year fields


cal

protected java.util.Calendar cal
The current date/time values as a calendar object


hasTime

protected boolean hasTime
Does this object hold a time value?


hasDate

protected boolean hasDate
Does this object hold a date value?


longDateTimeFormat

static java.text.DateFormat longDateTimeFormat
Long date/time format


longDateFormat

static java.text.DateFormat longDateFormat
Long date format


shortDateFormat

static java.text.DateFormat shortDateFormat
Short date format


longTimeFormat

static java.text.DateFormat longTimeFormat
Long time format


shortTimeFormat

static java.text.DateFormat shortTimeFormat
Short time format

Constructor Detail

AspDate

public AspDate(java.lang.String datestr)
        throws AspException
This constructor creates an AspDate object from a generic time string.


AspDate

public AspDate(java.util.Date date)
This constructor creates an AspDate object from a Java Date object.


AspDate

public AspDate(java.util.Date javaDate,
               boolean hasTime,
               boolean hasDate)
This constructor creates an AspDate object from a Java Date object, optionally setting the date and time values.


AspDate

public AspDate(java.util.Calendar cal)
This constructor creates an AspDate object from a Java calendar object.


AspDate

public AspDate(java.util.Calendar javaCal,
               boolean hasTime,
               boolean hasDate)
This constructor creates an AspDate object from a Java Calendar object, optionally setting the date and time values.


AspDate

protected AspDate(int month,
                  int day,
                  int year,
                  int hour,
                  int minute,
                  int second)
Constructor set with specific time settings.


AspDate

protected AspDate(int month,
                  int day,
                  int year)
Constructor set with specific date-only settings.

Method Detail

isNumber

private static boolean isNumber(java.lang.String str)
This function determines if the specified string contains a number


getMonthString

private static int getMonthString(java.lang.String str)
This funtion obtains from a string, the month the string corresponds to. Uses the build-in DateFormatSymbols class to match strings to months.


isTimeString

public static boolean isTimeString(java.lang.String str)
                            throws AspException
This function attempts to determine if the given string is a time string.


parseTime

protected void parseTime(java.lang.String str)
                  throws AspException
This function parses the given string into hour, minute, second, and sets the internal variables accordingly.


toCalendar

public java.util.Calendar toCalendar()
Converts this AspDate object to a Calendar object


toDate

public java.util.Date toDate()
Converts this AspDate object to a Date object


getMonth

public int getMonth()
Get the month value of this AspDate


getDay

public int getDay()
Get the day value of this AspDate


getYear

public int getYear()
Get the year value of this AspDate


getHour

public int getHour()
Get the hour value of this AspDate


getMinute

public int getMinute()
Get the minute value of this AspDate


getSecond

public int getSecond()
Get the second value of this AspDate


hasTime

public boolean hasTime()
Does this object have a time value?


hasDate

public boolean hasDate()
Does this object have a date value?


toString

public java.lang.String toString()
Convert this date to a string.