If you are getting an Javascript Parse Exception because GWT cannot
handle the type SQLDate this has been fixed in GWT 1.5 however you can
temporarily fix it for GWT with the use of some annotations:

@Type(type="com.package.DateTimeType")
public Date getDate()
{
    return date;
}

/**
 * This class is a custom type because of the GWT error when
converting
 * java.util.Date from java.sql.Timestamp
 * SEE: 
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/401426d112339c11
 * User aragos.
 *
 *
 * @author James Heggs
 *
 */
public class DateTimeType extends TimestampType
{
    private static final long serialVersionUID = 1L;

    public Object get(ResultSet rs, String name) throws SQLException
    {
        Timestamp timestamp = (Timestamp) super.get(rs, name);

        if (timestamp == null)
        {
            return null;
        }

        return new Date(timestamp.getTime());
    }
}

Hope this helps.



On Sep 15, 2:20 pm, Lothar Kimmeringer <[EMAIL PROTECTED]> wrote:
> Amit Dhingra schrieb:
>
> > I have sql date in the format "yyyy-MM-dd hh:mm:ss"
> > Please suggest the best method to convert it to java.util.Date format.
>
> On the server:
> java.util.Timestamp t = java.util.Timestamp.valueOf(sqldatetext);
>
> On the client (untested):
> DateTimeFormat format = DateTimeFormat("yyyy-MM-dd HH:mm:ss");
> Date date = format.parse(sqldatetext);
>
> Regards, Lothar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to