tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject [OT] Getting a pattern from a DateFormat object
Date Thu, 25 Oct 2007 22:26:51 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

Sorry for the off-topic post.

Does anyone know if I can get the pattern for a DateFormat object? If
I've got a SimpleDateFormat object, I know I can call toPattern() and
get a String describing the pattern.

Is there a way to do something similar?

For historical reasons, date formats are expected to be Strings in our
application instead of DateFormat objects. I'm re-factoring the way that
date formats are stored in our database and I need to support "default"
date formats. For instance, we have a "short_date" date format, and if
there's no format matching that key in the database, we want to use
DateFormat.getDateFormat(DateFormat.SHORT, currentLocale). In order to
do that with my existing code, I need to get the format string from that
DateFormat object. Anyone know how to do that?

(It looks like DateFormat.getDateInstance(DateFormat.SHORT) actually
returns a SimpleDateFormat object... anyone think it's a bad idea to bet
on that?)

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHIRgr9CaO5/Lv0PARAq3FAJ0VDkK/erGmF7JLv3GRUrEmYjuttACeIzv/
AzepDR8B3O2tXlvgMfhFcwk=
=GrII
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message