SEC: UNCLASSIFIED - [Opensource] SimpleDateFormat
McAuliffe, Robert
Robert.McAuliffe at defence.gov.au
Tue Mar 11 13:54:15 PST 2003
How about sub-classing it to extend its functionality, then all of your
DBObjects could extend your new subclass.
That way you can keep track of your changes better, and also cope with
upgrades to Expresso easier.
Rob
-----Original Message-----
From: Ben Switzer [mailto:ben at site85.com]
Subject: [Opensource] SimpleDateFormat
Good day all.
I've been contemplating how best to format dates on an
application wide
basis. What I've done is as follows:
in DBObject.java added method:
public String getFieldDateFormatted(String
fieldName, String
pattern)
throws DBException {
return jdbcUtil.getDateFieldFormatted(this,
fieldName,
pattern);
}
in JDBCUtil.java added method:
public String getDateFieldFormatted(DataObject
theObject, String
fieldName, String pattern)
throws DataException {
String formattedString;
synchronized(dateConvertFormatMap) {
SimpleDateFormat formatter =
getSimpleDateFormat(pattern);
formattedString =
formatter.format(this.getDateField(theObject, fieldName));
}
return formattedString;
}
I then use getFieldDateFormatted as I would gateFieldDate in
my
controller, except I supply a SimpleDateFormat pattern to
get a nicely
formatted String back. I'm not one modify the expresso
objects in my
apps directly, but I wasn't sure how else to achieve this
quickly and
universally through my app. Any suggestions or comments?
Best,
Ben Switzer [ben at site85.com]
site85.developer.*;
phone.416.466.4509;
_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/
More information about the Opensource
mailing list