OpenAPI 1.0

com.aquafold.openapi.type
Interface AQDateFactory


public interface AQDateFactory

This intetface provides factory methods for creation and validation of AQDate date objects.

An instance of this interface is available via aqua.type.date alias.


Method Summary
 AQDataSet adjustTimeZone(AQDataSet dataSet, String srcTimeZone, String destTimeZone)
          This method creates a new data set instance with dates shifted to a new time zone.
 String format(Object date, String pattern, Object timezone)
          Converts the specified date to a string according to the format pattern, time zone provided.
 String format(Object date, String pattern, Object timezone, Object locale)
          Converts the specified date to a string according to the format pattern, time zone, and locale provided.
 boolean isEarlier(AQDate a, AQDate b)
          Returns true if the date specified in parameter a is earlier than the date specified in parameter b.
 boolean isInRange(AQDate date, AQDate start, AQDate end)
          Returns true if the date is within the specified range (start...end, inclusive).
 boolean isLater(AQDate a, AQDate b)
          Returns true if the date specified in parameter a is later than the date specified in parameter b.
 boolean isValid(String date, String pattern)
          Returns true if the specified date string can be parsed to a valid date using the pattern provided.
 AQDate newDate()
          Creates a new date object initialized with the current platform time, locale, and time zone.
 AQDate newDate(int year, int month, int day)
          Creates a new date object initialized with the specified date, using platform locale and time zone.
 AQDate newDate(int year, int month, int day, int hours, int minutes, int seconds, Object timezone)
          Creates a new date object initialized with the specified date, time, and time zone; using platform locale.
 AQDate newDate(int year, int month, int day, int hours, int minutes, Object timezone)
          Creates a new date object initialized with the specified date and time, using platform locale and time zone.
 AQDate newDate(int year, int month, int day, Object timezone)
          Creates a new date object initialized with the specified date, using platform locale and the specified time zone.
 AQDate newDate(long time, Object timezone)
          Creates a new date object initialized with the specified time, and time zone; using platform locale.
 AQDate parse(String date, String pattern, Object timezone)
          Creates a new date object by parsing the specified date string using the specified pattern.
 AQDate parse(String date, String pattern, String timezone, String locale)
          Creates a new date object by parsing the specified date string using the specified pattern.
 

Method Detail

newDate

AQDate newDate()
Creates a new date object initialized with the current platform time, locale, and time zone.


newDate

AQDate newDate(long time,
               Object timezone)
Creates a new date object initialized with the specified time, and time zone; using platform locale.

Parameters:
time - UTC Time in milliseconds since January 1, 1970 00:00:00.000 GMT
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"

newDate

AQDate newDate(int year,
               int month,
               int day)
Creates a new date object initialized with the specified date, using platform locale and time zone.

Parameters:
year - Gregorian calendar year
month - Month (January is 1)
day - Day of month

newDate

AQDate newDate(int year,
               int month,
               int day,
               Object timezone)
Creates a new date object initialized with the specified date, using platform locale and the specified time zone.

Parameters:
year - Gregorian calendar year
month - Month (January is 1)
day - Day of month
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"

newDate

AQDate newDate(int year,
               int month,
               int day,
               int hours,
               int minutes,
               Object timezone)
Creates a new date object initialized with the specified date and time, using platform locale and time zone.

Parameters:
year - Gregorian calendar year
month - Month (January is 1)
day - Day of month
hours - Hour of day (0..23)
minutes - Minutes (0..59)
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"

newDate

AQDate newDate(int year,
               int month,
               int day,
               int hours,
               int minutes,
               int seconds,
               Object timezone)
Creates a new date object initialized with the specified date, time, and time zone; using platform locale.

Parameters:
year - Gregorian calendar year
month - Month (January is 1)
day - Day of month
hours - Hour of day (0..23)
minutes - Minutes (0..59)
seconds - Seconds (0..59)
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"

parse

AQDate parse(String date,
             String pattern,
             Object timezone)
             throws Exception
Creates a new date object by parsing the specified date string using the specified pattern. The resulting date object is initialized with the platform locale and time zone.

Parameters:
date - Date string
pattern - Pattern string as specified in SimpleDateFormat. Example: "yyyy/MM/dd HH.mm.ss"
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"
Returns:
AQDate An AQDate object;
Throws:
Exception - If the date string specified cannot be parsed.

parse

AQDate parse(String date,
             String pattern,
             String timezone,
             String locale)
             throws Exception
Creates a new date object by parsing the specified date string using the specified pattern. The resulting date object is initialized with the specified locale and time zone.

Parameters:
date - Date string
pattern - Pattern string as specified in SimpleDateFormat. Example: "yyyy/MM/dd HH.mm.ss"
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"
locale - Locale string as specified in Locale. Example: "en_US"
Returns:
AQDate An AQDate object;
Throws:
Exception - If the date string specified cannot be parsed.

isValid

boolean isValid(String date,
                String pattern)
Returns true if the specified date string can be parsed to a valid date using the pattern provided.

Parameters:
date - Date string.
pattern - Pattern as specified in SimpleDateFormat. Example: "yyyy/MM/dd HH.mm.ss"

isInRange

boolean isInRange(AQDate date,
                  AQDate start,
                  AQDate end)
Returns true if the date is within the specified range (start...end, inclusive).

Parameters:
date -
start - Start of the date interval.
end - End of the date interval.

isEarlier

boolean isEarlier(AQDate a,
                  AQDate b)
Returns true if the date specified in parameter a is earlier than the date specified in parameter b.

Parameters:
a - The date specified.
b - The date to be compared.

isLater

boolean isLater(AQDate a,
                AQDate b)
Returns true if the date specified in parameter a is later than the date specified in parameter b.

Parameters:
a - The date specified.
b - The date to be compared.

format

String format(Object date,
              String pattern,
              Object timezone)
Converts the specified date to a string according to the format pattern, time zone provided. A platform locale is used in formatting.

Parameters:
date - Date (either an AQDate or Date object
pattern - Pattern as specified in SimpleDateFormat. Example: "yyyy/MM/dd HH.mm.ss"
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"

format

String format(Object date,
              String pattern,
              Object timezone,
              Object locale)
Converts the specified date to a string according to the format pattern, time zone, and locale provided.

Parameters:
date - Date (either an AQDate or Date object
pattern - Pattern as specified in SimpleDateFormat. Example: "yyyy/MM/dd HH.mm.ss"
timezone - Time zone specification as defined in TimeZone. Example: "GMT-08:00"
locale - Locale string as specified in Locale. Example: "en_US"

adjustTimeZone

AQDataSet adjustTimeZone(AQDataSet dataSet,
                         String srcTimeZone,
                         String destTimeZone)
                         throws Exception
This method creates a new data set instance with dates shifted to a new time zone. This may be useful when the source data set is obtained from a database populated with dates in one time zone, while the script or the user is located in a different time zone. The implementation simply creates a copy of the original data set adding the difference between time zones to all dates (Date or AQDate) in the copy.

Parameters:
dataSet - Original data set.
srcTimeZone - Original data set time zone.
destTimeZone - Target time zone.
Throws:
Exception

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.