All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.bulletproof.util.Date

java.lang.Object
   |
   +----com.bulletproof.util.Date

public class Date
extends Object
The class Date represents a specific instant in time, with millisecond precision.


Variable Index

 o date
 o hour
 o millis
 o minute
 o month
 o second
 o year

Constructor Index

 o Date()
Allocates a Date object and intializes it to 1990/01/01.
 o Date(int)
Allocates a Date object specified by the juldate argument.
 o Date(int, int, int)
Allocates a Date object specified by the year, month, and date arguments.

Method Index

 o cloneDate()
Allocates a new Date object and initializes it so that it represents this date object.
 o decrement(int)
Decrement the date by one day
 o equals(Date)
Compares two dates.
 o format(Date)
Format a given date to the default format
 o format(Date, String)
Format a given date to a given format
 o format(String)
Format a given date to the default format
 o format(String, String)
Format a given date to the default format
 o formatForSql(Date, int)
Format a given date string create the SQL to update it to the database
 o formatForSql(Date, int, boolean)
Format a given date string create the SQL to update it to the database
 o formatForSql(String, int)
Format a given date string create the SQL to update it to the database
 o formatForSql(String, int, boolean)
Format a given date string create the SQL to update it to the database
 o formatFromSystem(String)
Format a given date to the default format
 o getDate()
Returns the day of the month represented by this date.
 o getDay()
Returns the day of the week represented by this date.
 o getDayOfYear()
Get the Julian day of this date
 o getDaysInMonth()
Get the number of days in this month
 o getDefaultFormat()
Get the value of the date box
 o getJulianDate()
Returns the date in a psuedo Julian format.
 o getMonth()
Returns the month represented by this date.
 o getYear()
Returns the year represented by this date, minus 1900.
 o increment(int)
Increment the date by the selected number of days
 o isLeapYear(int)
Determines if the given year is a leap year.
 o setDate(int)
Sets the day of the month of this date to the specified value.
 o setDefaultFormat(String)
Set the default date format
 o setJulianDate(int)
Sets the date using a Julian format.
 o setMonth(int)
Sets the month of this date to the specified value.
 o setYear(int)
Sets the year of this date to be the specified value plus 1900.
 o toString()
 o unformat(String)
Format a given date string create a date using the default format
 o unformat(String, String)
Format a given date string create a date given the format
 o unformatFromSystem(String)
Format a given date to the default format
 o unformattedDateValid()
Check whether the last date unformatted was invalid.

Variables

 o year
 public int year
 o month
 public int month
 o date
 public int date
 o hour
 public int hour
 o minute
 public int minute
 o second
 public int second
 o millis
 public int millis

Constructors

 o Date
 public Date()
Allocates a Date object and intializes it to 1990/01/01.

 o Date
 public Date(int year,
             int month,
             int date)
Allocates a Date object specified by the year, month, and date arguments.

Parameters:
year - the year minus 1900.
month - the month between 0-11.
date - the day of the month between 1-31.
 o Date
 public Date(int juldate)
Allocates a Date object specified by the juldate argument.

Parameters:
juldate - an integer in the format yyyymmdd.

Methods

 o cloneDate
 public Date cloneDate()
Allocates a new Date object and initializes it so that it represents this date object.

 o getDaysInMonth
 public int getDaysInMonth()
Get the number of days in this month

 o increment
 public Date increment(int days)
Increment the date by the selected number of days

 o decrement
 public Date decrement(int days)
Decrement the date by one day

 o getDayOfYear
 public int getDayOfYear()
Get the Julian day of this date

 o isLeapYear
 public boolean isLeapYear(int year)
Determines if the given year is a leap year. Returns true if the given year is a leap year.

Parameters:
year - the given year.
Returns:
true if the given year is a leap year; false otherwise.
 o getDay
 public int getDay()
Returns the day of the week represented by this date. The value returned is between 0 and 6, where 0 represents Sunday.

Returns:
the day of the week represented by this date.
 o getYear
 public int getYear()
Returns the year represented by this date, minus 1900.

Returns:
the year represented by this date, minus 1900.
 o setYear
 public void setYear(int year)
Sets the year of this date to be the specified value plus 1900.

Parameters:
year - the year value.
 o getMonth
 public int getMonth()
Returns the month represented by this date. The value returned is between 0 and 11, with the value 0 representing January.

Returns:
the month represented by this date.
 o setMonth
 public void setMonth(int month)
Sets the month of this date to the specified value.

Parameters:
month - the month value between 0-11.
 o getDate
 public int getDate()
Returns the day of the month represented by this date. The value returned is between 1 and 31.

Returns:
the day of the month represented by this date.
 o setDate
 public void setDate(int date)
Sets the day of the month of this date to the specified value.

Parameters:
date - the day of the month value between 1-31.
 o getJulianDate
 public int getJulianDate()
Returns the date in a psuedo Julian format. It is an integer in the form yyyymmdd

Returns:
the date in a psuedo Julian format.
 o setJulianDate
 public void setJulianDate(int juldate)
Sets the date using a Julian format. The expected parameter is an integer in the form yyyymmdd.

Parameters:
date - an integer in the form yyyymmdd.
 o equals
 public boolean equals(Date date2)
Compares two dates. The result is true if and only if the argument is not null and is a Date object that represents the same date, as this object.

Parameters:
date - the object to compare with.
Returns:
true if the dates are the same; false otherwise.
 o setDefaultFormat
 public static void setDefaultFormat(String dateFormat)
Set the default date format

Parameters:
dateFormat - the default date format
 o getDefaultFormat
 public static String getDefaultFormat()
Get the value of the date box

Returns:
the default date format
 o format
 public static String format(String thisDate)
Format a given date to the default format

Parameters:
date - the date to format
Returns:
the new newly formatted date
 o formatFromSystem
 public static String formatFromSystem(String thisDate)
Format a given date to the default format

Parameters:
date - the date to format
Returns:
the new newly formatted date
 o unformatFromSystem
 public static Date unformatFromSystem(String thisDate)
Format a given date to the default format

Parameters:
date - the date to format
Returns:
the new newly formatted date
 o format
 public static String format(String thisDate,
                             String format)
Format a given date to the default format

Parameters:
date - the date to format
format - the format of the date (eg: "mm/dd/yy")
Returns:
the new newly formatted date
 o format
 public static String format(Date thisDate)
Format a given date to the default format

Parameters:
date - the date to format
Returns:
the new newly formatted date
 o format
 public static String format(Date thisDate,
                             String format)
Format a given date to a given format

Parameters:
date - the date to format
format - the format of the date (eg: "mm/dd/yy")
Returns:
the new newly formatted date
 o formatForSql
 public static String formatForSql(String thisDate,
                                   int datasourceType)
Format a given date string create the SQL to update it to the database

Parameters:
date - the date to parse
datasourceType - the type of datasource we are writing to
Returns:
the SQL subclause
 o formatForSql
 public static String formatForSql(String thisDate,
                                   int datasourceType,
                                   boolean showTime)
Format a given date string create the SQL to update it to the database

Parameters:
date - the date to parse
datasourceType - the type of datasource we are writing to
showTime - include the time on the formatted SQL
Returns:
the SQL subclause
 o formatForSql
 public static String formatForSql(Date thisDate,
                                   int datasourceType)
Format a given date string create the SQL to update it to the database

Parameters:
date - the date to parse
datasourceType - the type of datasource we are writing to
Returns:
the SQL subclause
 o formatForSql
 public static String formatForSql(Date thisDate,
                                   int datasourceType,
                                   boolean showTime)
Format a given date string create the SQL to update it to the database

Parameters:
date - the date to parse
datasourceType - the type of datasource we are writing to
Returns:
the SQL subclause
 o unformat
 public static Date unformat(String thisDate)
Format a given date string create a date using the default format

Parameters:
date - the date to parse
Returns:
the new date
 o unformat
 public static Date unformat(String thisDate,
                             String format)
Format a given date string create a date given the format

Parameters:
date - the date to parse
format - the format of the date (eg: "mm/dd/yy")
Returns:
the new date
 o unformattedDateValid
 public static boolean unformattedDateValid()
Check whether the last date unformatted was invalid.

Returns:
whether the last date unformatted was invalid.
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index