|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.misc.LyDateFormatter
public final class LyDateFormatter
This class implements some static methods to format and parse dates using a particular date format. Format passed to these methods must use :
Date formats examples: MM/dd/yyyy hh:mm:ss
or dd/MM/yy
or
dd/MM/yyyy HH:mm
.
Field Summary | |
---|---|
static java.lang.String |
__VERSION
|
static java.text.DateFormat |
_internalDateFormat
Internal date format to save ids, or peer values |
Constructor Summary | |
---|---|
LyDateFormatter()
|
Method Summary | |
---|---|
static java.util.Date |
buildDate(int year,
int month,
int date,
int hrs,
int min,
int sec)
Allocates a Date object and initializes it so that it represents the instant at the start of the second specified by the year, month, date, hrs, min, and sec arguments, in the local time zone. |
static java.util.Date |
buildDate(long dateInMillis,
java.lang.String format)
Allocates a Date object that represents the given date in milliseconds. |
static java.lang.String |
checkDate(java.lang.String val,
java.text.DateFormat dateFormat)
Checks whether the given date string is correct according to format. |
static java.lang.String |
format(java.util.Date date,
java.text.DateFormat format,
LyEnvironment env)
Formats a date with the given format. |
static java.lang.String |
format(java.util.Date date,
java.text.DateFormat format,
LyEnvironment env,
java.lang.String timeZone)
Formats a date with the given format. |
static java.lang.String |
format(java.util.Date date,
java.lang.String format)
Formats a date with the given format. |
static java.lang.String |
format(java.util.Date date,
java.lang.String format,
LyEnvironment env)
Formats a date with the given format. |
static java.util.Date |
fromString(java.lang.String dateString)
Parses a string to retrieve a date from the Date.toString() method. |
static int |
getAge(java.util.Date date)
Utility method that returns the age from a given date. |
static int |
getDate(java.util.Date date)
Gets the day of the month represented by the specified Date object. |
static int |
getDay(java.util.Date date)
Gets the day of the week represented by the specified date. |
static int |
getDayOfYear(java.util.Date date)
Gets the day of the year represented by the specified Date object. |
static int |
getHours(java.util.Date date)
Gets the hour represented by the specified Date object. |
static java.text.DateFormat |
getInternalDateFormat()
Internal date format to save ids, or peer values |
static int |
getMinutes(java.util.Date date)
Gets the number of minutes past the hour represented by the specified date, as interpreted in the local time zone. |
static int |
getMonth(java.util.Date date)
Gets a number representing the month that contains (or begins with) the instant in time represented by the specified Date object. |
static double |
getRealAge(java.util.Date date)
Utility method that returns the age from a given date as a float. |
static int |
getSeconds(java.util.Date date)
Gets the number of seconds past the minute represented by the specified date. |
static int |
getYear(java.util.Date date)
Gets a value that is the result of subtracting 1900 from the year that contains (or begins with) the instant in time represented by the specifie Date object, as interpreted in the local time zone. |
static java.util.Date |
parse(java.lang.String dateString,
java.lang.String format)
Parses a string to retrieve a date with the given format. |
static java.util.Date |
parse(java.lang.String dateString,
java.lang.String format,
LyEnvironment env)
Parses a string to retrieve a date with the given format. |
static java.util.Date |
parse(java.lang.String dateString,
java.lang.String format,
LyEnvironment env,
java.lang.String timeZone)
Parses a string to retrieve a date with the given format. |
static java.util.Date |
setDate(java.util.Date date,
int d)
Sets the day of the month of the specified Date object to the specified value. |
static java.util.Date |
setDayOfYear(java.util.Date date,
int d)
Sets the day of the year of the specified Date object to the specified value. |
static java.util.Date |
setHours(java.util.Date date,
int h)
Sets the hour of the Date object to the specified value. |
static void |
setInternalDateFormat(java.lang.String format)
Internal date format to save ids, or peer values |
static java.util.Date |
setMinutes(java.util.Date date,
int m)
Sets the minutes of the Date object to the specified value. |
static java.util.Date |
setMonth(java.util.Date date,
int m)
Sets the month of the date to the specified value. |
static java.util.Date |
setSeconds(java.util.Date date,
int s)
Sets the seconds of the Date to the specified value. |
static java.util.Date |
setYear(java.util.Date date,
int y)
Sets the year of the Date object to be the specified value plus 1900. |
static java.lang.String |
toString(java.util.Date date)
Parses a string to retrieve a date from the Date.toString() method. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String __VERSION
public static java.text.DateFormat _internalDateFormat
Constructor Detail |
---|
public LyDateFormatter()
Method Detail |
---|
public static java.lang.String format(java.util.Date date, java.text.DateFormat format, LyEnvironment env, java.lang.String timeZone)
date
- The date that must be formatted.format
- The format of the result.env
- Current environment (used to retrieve current date locale).timeZone
- the time zone to use
public static java.lang.String format(java.util.Date date, java.text.DateFormat format, LyEnvironment env)
date
- The date that must be formatted.format
- The format of the result.env
- Current environment (used to retrieve current date locale).
public static java.lang.String format(java.util.Date date, java.lang.String format)
date
- The date that must be formatted.format
- The format of the result.
public static java.lang.String format(java.util.Date date, java.lang.String format, LyEnvironment env)
date
- The date that must be formatted.format
- The format of the result.env
- Current environment (used to retrieve current date locale).
public static java.util.Date parse(java.lang.String dateString, java.lang.String format)
dateString
- The string that must be parsed.format
- The format of the string.
public static java.util.Date parse(java.lang.String dateString, java.lang.String format, LyEnvironment env)
dateString
- The string that must be parsed.format
- The format of the string.env
- Current environment (used to retrieve current date locale).
public static java.util.Date parse(java.lang.String dateString, java.lang.String format, LyEnvironment env, java.lang.String timeZone)
dateString
- The string that must be parsed.format
- The format of the string.env
- Current environment (used to retrieve current date locale).timeZone
- The time zone to use
public static java.util.Date fromString(java.lang.String dateString)
Date.toString()
method. In all cases, we
must have : dateA
equals fromString(dateA.toString())
dateString
- The string that must be parsed.
public static java.lang.String toString(java.util.Date date)
Date.toString()
method. In all cases, we
must have : dateA
equals fromString(dateA.toString())
dateString
- The string that must be parsed.
public static int getDate(java.util.Date date)
date
- the date
public static int getDay(java.util.Date date)
Those values represent the day of the week that contains (or begins with) the instant in time represented by the Date object, as interpreted in the local time zone.
date
- the date
public static int getHours(java.util.Date date)
date
- the date
public static int getMinutes(java.util.Date date)
date
- the date
public static int getMonth(java.util.Date date)
date
- the date
public static int getSeconds(java.util.Date date)
date
- the date
public static int getYear(java.util.Date date)
date
- the date
public static java.util.Date setDate(java.util.Date date, int d)
date
- the date to modifyd
- the day of the month value between 1-31.
public static java.util.Date setHours(java.util.Date date, int h)
date
- the date to modifyh
- the hour value.
public static java.util.Date setMinutes(java.util.Date date, int m)
date
- the date to modifym
- the value of the minutes.
public static java.util.Date setMonth(java.util.Date date, int m)
date
- the date to modifym
- the month value between 0-11.
public static java.util.Date setSeconds(java.util.Date date, int s)
date
- the date to modifys
- the seconds value.
public static java.util.Date setYear(java.util.Date date, int y)
date
- the date to modifyy
- the year value.
public static java.util.Date buildDate(long dateInMillis, java.lang.String format)
dateInMillis
- the date as a long.
public static java.util.Date buildDate(int year, int month, int date, int hrs, int min, int sec)
year
- the year minus 1900.month
- the month between 0-11.date
- the day of the month between 1-31.hrs
- the hours between 0-23.min
- the minutes between 0-59.sec
- the seconds between 0-59.
public static java.lang.String checkDate(java.lang.String val, java.text.DateFormat dateFormat)
val
- date stringdateFormat
- date format
public static int getDayOfYear(java.util.Date date)
date
- the date
public static java.util.Date setDayOfYear(java.util.Date date, int d)
date
- the date to modifyd
- the day of the year value between 0-366.
public static void setInternalDateFormat(java.lang.String format)
format
- public static java.text.DateFormat getInternalDateFormat()
public static int getAge(java.util.Date date)
date
- The date from which the age is requested.
public static double getRealAge(java.util.Date date)
date
- The date from which the age is requested.
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |