You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Brad Balmer <bb...@peapod.com> on 2005/01/14 18:17:59 UTC

Help converting String to Timestamp

I sent this to the wrong list at first by accident, so sorry about the cross
post:

 

 

 

I'm trying to convert a String into a Timestamp using:

 

ConvertUtils.register(new SqlTimestampConverter(), Timestamp.class);

try {

   timestamp = (Timestamp)ConvertUtils.convert(fullStringTimestamp,
Timestamp.class);

}catch(Exception E) {

   E.printStackTrace();

}

 

The fullStringTimestamp value is 2005-02-03 03:30.000000000

 

 

 

Could anybody please point me in the right direction as this is throwing a
org.apache.commons.beanutils.ConversionException.

 

 

 

Thanks.


RE: Help converting String to Timestamp

Posted by Brad Balmer <bb...@peapod.com>.
Thanks.  Looking at it for so long it looked normal to me.

-----Original Message-----
From: Kishore Senji [mailto:ksenji@gmail.com] 
Sent: Friday, January 14, 2005 12:01 PM
To: Jakarta Commons Users List; bbalmer@peapod.com
Subject: Re: Help converting String to Timestamp

On Fri, 14 Jan 2005 11:17:59 -0600, Brad Balmer <bb...@peapod.com> wrote:
> I sent this to the wrong list at first by accident, so sorry about the
cross
> post:
> 
> I'm trying to convert a String into a Timestamp using:
> 
> ConvertUtils.register(new SqlTimestampConverter(), Timestamp.class);
> 
> try {
> 
>   timestamp = (Timestamp)ConvertUtils.convert(fullStringTimestamp,
> Timestamp.class);
> 
> }catch(Exception E) {
> 
>   E.printStackTrace();
> 
> }
> 
> The fullStringTimestamp value is 2005-02-03 03:30.000000000

You are missing the seconds field in the fullStringTimestamp
It should be in the format yyyy-mm-dd hh:mm:ss.fffffffff

> 
> Could anybody please point me in the right direction as this is throwing a
> org.apache.commons.beanutils.ConversionException.
> 
> Thanks.
> 
>

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


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


Re: Help converting String to Timestamp

Posted by Kishore Senji <ks...@gmail.com>.
On Fri, 14 Jan 2005 11:17:59 -0600, Brad Balmer <bb...@peapod.com> wrote:
> I sent this to the wrong list at first by accident, so sorry about the cross
> post:
> 
> I'm trying to convert a String into a Timestamp using:
> 
> ConvertUtils.register(new SqlTimestampConverter(), Timestamp.class);
> 
> try {
> 
>   timestamp = (Timestamp)ConvertUtils.convert(fullStringTimestamp,
> Timestamp.class);
> 
> }catch(Exception E) {
> 
>   E.printStackTrace();
> 
> }
> 
> The fullStringTimestamp value is 2005-02-03 03:30.000000000

You are missing the seconds field in the fullStringTimestamp
It should be in the format yyyy-mm-dd hh:mm:ss.fffffffff

> 
> Could anybody please point me in the right direction as this is throwing a
> org.apache.commons.beanutils.ConversionException.
> 
> Thanks.
> 
>

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