|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DateFormatter
This stateless session bean provides utility methods to convert dates into commonly needed string formats, as well as strings in commonly used date formats into Java Dates.
For maximum efficiency this session bean is implemented only
as a local EJB, and this interface represents the
local interface to the bean.
The following code sample shows one way of using the methods in this session bean:
Date now = new Date();
String formattedDate = "";
Date parsedDate = null;
try
{
DateFormatter df = SessionBeanProvider.getDateFormatter();
formattedDate = df.getDateTime( now );
try
{
parsedDate = df.getDateTime( formattedDate );
}
catch ( ParseException pex )
{
// Do error processing
}
df.remove();
}
catch ( Exception ex )
{
// Do error processing.
}
Copyright 2003, wedoit4u.biz
SessionBeanProvider.getDateFormatter()| Method Summary | |
|---|---|
java.lang.String |
getDateTime(java.util.Date date)
Formats the specified Date object in ISO 8601
date-time format (yyyy-MM-dd'T'HH-mm-ss). |
java.util.Date |
getDateTime(java.lang.String date)
Parses the specified String object in ISO 8601
date-time format (yyyy-MM-dd'T'HH-mm-ss) into a
Java Date. |
java.lang.String |
getDay(java.util.Date date)
Formats the specified Date object in ISO 8601
day format (yyyy-MM-dd). |
java.util.Date |
getDay(java.lang.String date)
Parses the specified String in ISO 8601
day format (yyyy-MM-dd) into a Java Date. |
java.lang.String |
getSQLTimestamp(java.util.Date date)
Formats the specified Date object in SQL
timestamp format (yyyy-MM-dd HH-mm-ss). |
java.util.Date |
getSQLTimestamp(java.lang.String date)
Parses the specified String object in SQL
timestamp format (yyyy-MM-dd HH-mm-ss) into a
Java Date. |
java.lang.String |
getTime(java.util.Date date)
Formats the specified Date object in ISO 8601
time format (HH:mm:ss). |
java.util.Date |
getTime(java.lang.String date)
Parses the specified String object in ISO 8601
time format (HH:mm:ss) into a Java Date. |
| Methods inherited from interface javax.ejb.EJBLocalObject |
|---|
getEJBLocalHome, getPrimaryKey, isIdentical, remove |
| Method Detail |
|---|
java.lang.String getDay(java.util.Date date)
Date object in ISO 8601
day format (yyyy-MM-dd). This is also the SQL
Date format.
date - - The input date that is to be formatted.
java.util.Date getDay(java.lang.String date)
throws java.text.ParseException
String in ISO 8601
day format (yyyy-MM-dd) into a Java Date.
This is also the SQL Date format.
date - - The input date that is to be parsed.
java.text.ParseException - - If an exception is encountered while
attempting to parse the input String in yyyy-MM-dd format
into a Java Date.java.lang.String getTime(java.util.Date date)
Date object in ISO 8601
time format (HH:mm:ss). This is also the SQL
Time format.
date - - The input date that is to be formatted.
java.util.Date getTime(java.lang.String date)
throws java.text.ParseException
String object in ISO 8601
time format (HH:mm:ss) into a Java Date. This
is also the SQL Time format.
date - - The input date that is to be parsed.
java.text.ParseException - - If an exception is encountered while
attempting to parse the input String in HH-mm-ss format
into a Java Date.java.lang.String getDateTime(java.util.Date date)
Date object in ISO 8601
date-time format (yyyy-MM-dd'T'HH-mm-ss). This is not
strictly ISO compliant, since this would indicate that the time
is in zero meridian, while in reality this time
is in US central time.
date - - The input date that is to be formatted.
java.util.Date getDateTime(java.lang.String date)
throws java.text.ParseException
String object in ISO 8601
date-time format (yyyy-MM-dd'T'HH-mm-ss) into a
Java Date. This is not
strictly ISO compliant, since this would indicate that the time
is in zero meridian, while in reality this time
is in US central time.
date - - The input string that is to be formatted.
java.text.ParseExceptionjava.lang.String getSQLTimestamp(java.util.Date date)
Date object in SQL
timestamp format (yyyy-MM-dd HH-mm-ss).
date - - The input date that is to be formatted.
java.util.Date getSQLTimestamp(java.lang.String date)
throws java.text.ParseException
String object in SQL
timestamp format (yyyy-MM-dd HH-mm-ss) into a
Java Date.
date - - The input string that is to be formatted.
java.text.ParseException
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||