You can also use gwt-time library (http://code.google.com/p/gwt-
time/).
Formatting from/to date is pretty easy:
String result = new DateTime(d.getTime()).toString("yyyy-MM-dd
HH:mm:ss");
or parse from string:
DateTime date = DateTimeFormat.forPattern("yyyy-MM-dd
HH:mm:ss").parseDateTime(result)
Peter
On 18. Júl, 16:45 h., Sebastian Rothbucher
<[email protected]> wrote:
> Hi Markus,
>
> assume you can accept minor deviations of both system's clocks (both
> should have Internet time anyway), you can use Google's DateFormat
> class (com.google.gwt.i18n.client.DateTimeFormat). java.util.Date is
> still available. Using the Google date format is required - but
> accepts the same syntax...
>
> Hope this helps
> Sebastian
>
> On Jul 17, 4:12 pm, Magnus <[email protected]> wrote:
>
> > Hi,
>
> > in my server side code I use this method to get a timestamp string:
>
> > private String getDateTimeStr (java.util.Date d)
> > {
> > DateFormat fmt = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
> > String t = fmt.format (d);
> > return (t);
> > }
>
> > On client side, these classes (Date, SimpleDateFormat) are not
> > available.
> > How can I retrieve the time values on client side?
>
> > Otherwise I had to make a RPC server call whenerver I need a
> > timestamp...
>
> > Thanks
> > Magnus
--
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.