Date uses zero-based integers for the month, so January is 0 and August is 7.
getDay() returns the day of the week, with 2 being Tuesday. You probably wanted getDate() An alternative way would be to use com.google.gwt.i18n.client.DateTimeFormat Paul Xandrios wrote: > Hi, > > I have noticed a strange problem with the Date class. Example: > > Date date = record.getAsDate(field); > String dateString = (date.getMonth()+"/"+date.getDay()+"/"+ > (date.getYear()+1900) > +" / "+date.getTime()+" / "+date.toString()); > > dateString now returns the following: > > 7/2/2010 / 1280786400000 / Tue Aug 03 00:00:00 CEST 2010 > > The timestamp and toString values are correct. However the > date.getMonth() and date.getDay() are not. > > Does anybody have an idea what could be wrong here? Should I use > another method to get the date as mm/dd/yyy string? > > I'm using GWT 1.5 by the way. > > Thanks! > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---