> I need a Date variable (not a string) in the format 12/05/2009 for
> example.

You're confusing things. A date is an object holding information about
an instant in time (typically this is represented internally as a
long), it has nothing to do with formats. Now, for a more thorough
explanation, go read the javadocs for the Date object:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html

> i only have a date variable like Tue May 12....

If you're using eclipse I'm guessing that you're talking about the
value that the "Variables" view in the "Debug" perspective shows for
your date. That's the result of the toString method of the Date
object, so it is only a specially formatted textual representation of
that object. You can format a Date object in almost any way you want
with a DateFormat instance in your server-side code (http://
java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html) or with a
DateTimeFormat in client-side GWT code (http://google-web-
toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/i18n/client/
DateTimeFormat.html)

Would you mind describing exactly what you're trying to accomplish ?
If it's doable in 2-3 lines of code somebody will eventually paste
that 2-3 lines of code and you'll have what you need.

Hope that helps,

Salvador

On 15 mai, 14:11, sindroide <[email protected]> wrote:
> thanks for your replay mike, what i need it's quite simple but i still
> couldn't do it.
> I need a Date variable (not a string) in the format 12/05/2009 for
> example.
> I thought that getting a format with DateTimeFormat as "dd/MM/yyyy"
> and making a new date variable with that format i would have some dd/
> mm/yyyy but i don't.... i only have a date variable like Tue May
> 12....
>
> The only case that i have something like dd/mm/yyyy is a string wich
> it anusefull for me.
>
> Could you please help me!
>
> On May 15, 12:00 am, mdwarne <[email protected]> wrote:
>
> > Hi sindroide,
> > Are you trying to change a Text String date, into another Text String
> > date?
>
> > I'm not sure if I understand your needs.
>
> > But, look at the static "parse" method in the Date class:
>
> > Date d = Date.parse("Tue, xxxxxx");
>
> > String newDate  = DateTimeFormat.getFormat("dd/MM/yyyy").format(d);
>
> > Mike.
>
> > On May 12, 3:28 am, sindroide <[email protected]> wrote:
>
> > > Hi, I can not get in anyway a Date value like 2009/05/12 from text
> > > like 'Tue May 12 00:00:00 ART 2009'
> > > The only way I can not get illegalArgumentexception es like
>
> > > Date f = new Date();
>
> > > // this print like i want but it's text
> > > System.out.println(DateTimeFormat.getFormat("dd/MM/yyyy").format
> > > (f));
>
> > > //this prints date but ... in words format
> > > System.out.println(DateTimeFormat.getFormat("dd/MM/yyyy").parse
> > > (DateTimeFormat.getFormat("dd.MM.yyyy").format(f)));
>
> > > cuold you please help me. Thanks for advance!
>
>
--~--~---------~--~----~------------~-------~--~----~
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