How about DateTimeFormat (http://google-web-toolkit.googlecode.com/svn/
javadoc/1.5/com/google/gwt/i18n/client/DateTimeFormat.html):
        String timestampStr = "2009-04-07 12:30:00.000";
        DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("yyyy-
MM-dd HH:mm:ss.SSS");
        Date dateTime = dateTimeFormat.parse(timestampStr);

DateTimeFormat works in both hosted and web mode.

According to:
http://code.google.com/webtoolkit/doc/1.6/RefJreEmulation.html
java.sql.Timestamp.valueOf() is emulated, so perhaps you should file a
bug report about it.

Tony
--
Tony Strauss
Designing Patterns, LLC
http://www.designingpatterns.com
http://blogs.designingpatterns.com

On Apr 24, 10:14 am, Neo <[email protected]> wrote:
> No. It is not possible to get a Date or a Timestamp.
> The String is coming from an Editable Grid Control.
>
> On Apr 24, 6:57 pm, Salvador Diaz <[email protected]> wrote:
>
> > One way would be to skip the first timestamp to string conversion.
> > Where does the string comes from ? Would it be possible to get a Date
> > or Timestamp object instead of getting the string ?
>
> > Hope that helps
>
> > Salvador
>
> > On Apr 24, 3:44 pm, Neo <[email protected]> wrote:
>
> > > Hi,
>
> > > I am trying to convert a string to a Timestamp value in my Client side
> > > code. It works fine in Hosted mode but the same code fails in Web
> > > mode.
>
> > > This is my code :
> > > java.sql.Timestamp startTime = java.sql.Timestamp.valueOf(<timestamp
> > > as string>);
>
> > > Got this exception in web mode :
>
> > > Exception occurred :
> > > Invalid escape format: 2009-04-07 12:30:00.0
>
> > > Can you please help me out in this and suggest a way to convert the
> > > string to Timestamp so that it works both in Hosted mode and Web mode.- 
> > > Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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