struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Galbreath" <mark_galbre...@qat.com>
Subject RE: DateUtilities for ActionForms?
Date Mon, 02 Jun 2003 14:31:18 GMT
I gnu you would get me on that!

-----Original Message-----
From: Andrew Hill [mailto:andrew.david.hill@gridnode.com] 
Sent: Monday, June 02, 2003 10:19 AM

<snip>
is the only reason for the latter's existence
</snip>

Which is the latter? java.util.Date or java.sql.TimeStamp?

Ive never figured out the reason for having a seperate sql version. Dont see
why they couldnt just use java.util.Date...

TimeStamp on the otherhand provides support (in a rather nasty way!) for
nanoseconds...

-----Original Message-----
From: Mark Galbreath [mailto:mark_galbreath@qat.com]
Sent: Monday, 2 June 2003 22:06
To: 'Struts Users Mailing List'
Subject: RE: DateUtilities for ActionForms?


java.sql.Date is a subclass of java.util.Date (as is java.sql.TimeStamp) and
as far as I can see, is the only reason for the latter's existence.  As
David Flannigan points out in "Java In A Nutshell, 4th Ed" (O'Reilly 2002),
p. 654: "Since Java 1.1 many of the methods in the Date class have been
deprecated in favor of the methods of the Calendar class."  java.sql.Date
exists simply to pass milliseconds through JDBC to and from a database.

Mark

-----Original Message-----
From: Gareth Andrew [mailto:gareth.andrew@ntlworld.com]
Sent: Saturday, May 31, 2003 4:07 PM
To: Struts Users Mailing List
Subject: Re: DateUtilities for ActionForms?


What are you talking about?  I assume you mean the java.util.Date class.
This class is anything but deprecated, it is the de facto method of storing
a date in Java. The reason it has a lot of deprecated methods and
constructors is that in 1.2 the class was extensively refactored with a lot
of the functionality moved into helper classes such as Calender and
DateFormat.  I hope this isn't why you are recommending java.sql.date over
java.util.date.

Gareth.

Mark Galbreath wrote:

>Why are you guys continuing to advocate the use of a deprecated class? 
>Look at the API!
>
>Mark
>
>-----Original Message-----
>From: Gareth Andrew [mailto:gareth.andrew@ntlworld.com]
>Sent: Saturday, May 31, 2003 1:59 PM
>To: Struts Users Mailing List
>Subject: Re: DateUtilities for ActionForms?
>
>
>If you want to use Locale aware conversions perhaps you should be using 
>LocaleBeanUtils rather than BeanUtils.  You should be able to convert a 
>string to a date as follows:
>
>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 <gareth.andrew@ntlworld.com>
>>>Reply-To: "Struts Users Mailing List" 
>>><struts-user@jakarta.apache.org>
>>>To: Struts Users Mailing List <struts-user@jakarta.apache.org>
>>>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:part1.07090707.01010603@ntlworld.com>
>>>implementation that converts an incoming locale-sensitive String into 
>>>a |java.util.Date| object, optionally using a default value or 
>>>throwing a |ConversionException| 
>>><cid:part2.07040802.01000900@ntlworld.com> 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: struts-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>>
>>_________________________________________________________________
>>Help STOP SPAM with the new MSN 8 and get 2 months FREE* 
>>http://join.msn.com/?page=features/junkmail
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message