Post the relevant code and let's see what we can do... Mark
-----Original Message----- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Saturday, May 31, 2003 12:12 PM To: [EMAIL PROTECTED] Subject: RE: DateUtilities for ActionForms? Then why are the months hard-coded? I am really just having a huge issue with my ValueObject having a java.util.Date, and my DynaForm seemingly needing a String, then converting the String to a Date before copying it to the ValueObject. I was suppose to deliver this Friday, but the Dates are kicking my butt. --- Thanks... Mick Knutson --- >From: "Mark Galbreath" <[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 11:32:53 -0400 > >java.util.Calendar has built-in locale conversions and takes a variety >of input formats - it's really a pretty versatile class. > >Mark > >-----Original Message----- >From: Mick Knutson [mailto:[EMAIL PROTECTED] >Sent: Saturday, May 31, 2003 11:21 AM >To: [EMAIL PROTECTED] >Subject: RE: DateUtilities for ActionForms? > > >OK, But my dates are international, and I do not know which of >potentially several formats they may need to be in to support my fully >Internationalized > >application. >Such as the use of "Jan, Feb...etc..." would never work in this >context. > > > >--- >Thanks... >Mick Knutson >--- > > > > > > >From: "Mark Galbreath" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" > ><[EMAIL PROTECTED]> > >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > >Subject: RE: DateUtilities for ActionForms? > >Date: Fri, 30 May 2003 09:18:18 -0400 > > > >I wrote a simple conversion method and pass the Strings through - no > >hassle at all. Given the String "Jan 1, 2003": > > > >Calendar date = getDate( string ); > > > >private Calendar getDate( String string ) { > > Calender cal = Calender.getInstance(); > > String formatted_date = null; > > String[] months = { > >"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","De > >c" >}; > > StringTokenizer st = new StringTokenizer( string ); > > String str = st.nextToken(); > > > > for( int i; i < months.length; i++ ) { > > > > if( str.equalsIgnoreCase( months[ i ] )) { > > month = i; > > break; > > } > > } > > > > String temp = st.nextToken(); > > StringTokenizer token = new StringTokenizer( temp, "," ); > > date = ( new Integer(( String ) token.nextElement() )).intValue(); > > year = ( new Integer(( String ) st.nextElement() )).intValue(); > > > > return( cal.set( year, month + 1, date )); > >} > > > > > >Easy, heh? You could also use regular expressions if you are using > >JDK 1.4. > > > >Mark > > > >-----Original Message----- > >From: Mick Knutson [mailto:[EMAIL PROTECTED] > >Sent: Friday, May 30, 2003 4:09 AM > >To: [EMAIL PROTECTED] > >Subject: DateUtilities for ActionForms? > > > > > >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] > > > >_________________________________________________________________ >Add photos to your e-mail with MSN 8. Get 2 months FREE*. >http://join.msn.com/?page=features/featuredemail > > >--------------------------------------------------------------------- >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]