java.util.Date myDate = (java.util.Date)LocaleConvertUtils.convert("18 Jan 2003", Class.forName("java.util.Date"));
If you change your form-properties to strings, copyProperties() should automagically do the String->Date conversion for you - although I think it uses toString() for Date->String so you'd need to use the DateFormat class and some locale information you have about the user (request.getLocale()?) to reformat the string.
Gareth
Mick Knutson wrote:
I looked at the javadocs, but I just can't seem to understand how to use that. I looked at the struts source, but that is never used there.
Does anyone have a working example of this?
--- Thanks... Mick Knutson ---
From: Gareth Andrew <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: DateUtilities for ActionForms? Date: Sat, 31 May 2003 18:23:27 +0100
Mick,
Have you tried using the BeanUtils converters. From the docs:
*org.apache.commons.beanutils.locale.converters.DateLocaleConverter
*
Standard |LocaleConverter| <cid:[EMAIL PROTECTED]> implementation that converts an incoming locale-sensitive String into a |java.util.Date| object, optionally using a default value or throwing a |ConversionException| <cid:[EMAIL PROTECTED]> if a conversion error occurs.
It sounds like it might help, but I haven't used it before so i can't comment. At the very least the source might be useful if you decide you need to write your own DateUtilities.
HTH.
Gareth.
Mick Knutson wrote:
Is there already a set of DateUtilities for ActionForms?
I am finding myself converting to and from Strings and also reformating my Dates to and from my DB.
I am using EntityBeans and ValueObjects with my ActionForms, so to keep the types in synch, it seems I have to do serious conversion all the time.
Thanks in advance for the help.
--- Thanks... Mick Knutson ---
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]