date picker date components
Hi, How do I get date components, eg: Month, Day, Year, from datepicker? Since those are deprecated in Java Date and Calendar is not included in GWT. I couldn't find a way nor any post about this issue. Thank you, Tony --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: date picker date components
Even though those Date methods are deprecated, you really have no other options to get the date fields. You'll have deprecation warnings all over the place, but until something like joda-time gets ported to GWT there's simply no other way Cheers, Salvador On Apr 16, 10:12 am, "tony.p.." wrote: > Hi, > > How do I get date components, eg: Month, Day, Year, from datepicker? > Since those are deprecated in Java Date and Calendar is not included > in GWT. I couldn't find a way nor any post about this issue. > > Thank you, > Tony --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: date picker date components
Thank you Salvador, I tried it, got wrong results: Date date = (Date) event.getValue(); int year = date.getYear(); month = date.getMonth(); day = date.getDay(); the result was (year, month, day): 109, 3, 3 Has nothing to do with today's date components. Am I missing something? Do I have to convert from date.getTime()? On Apr 16, 3:30 am, Salvador Diaz wrote: > Even though those Date methods are deprecated, you really have no > other options to get the date fields. You'll have deprecation warnings > all over the place, but until something like joda-time gets ported to > GWT there's simply no other way > > Cheers, > > Salvador > > On Apr 16, 10:12 am, "tony.p.." wrote: > > > Hi, > > > How do I get date components, eg: Month, Day, Year, from datepicker? > > Since those are deprecated in Java Date and Calendar is not included > > in GWT. I couldn't find a way nor any post about this issue. > > > Thank you, > > Tony --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: date picker date components
Have a look at the Date api? getYear() returns the number of years since 1900, so 109 represents 1900+109=2009 getMonth() returns the month, 0 = January, 11 = December getDay() returns the day of the week, 0 = sunday ... 6 = saturday and getDate() returns the day of the month (this one is actually what you would expect, 1 = 1st, 31=31st) -jason On Apr 16, 2009, at 11:24 AM, tony.p.. wrote: > > Thank you Salvador, I tried it, got wrong results: > > Date date = (Date) event.getValue(); > int year = date.getYear(); > month = date.getMonth(); > day = date.getDay(); > > the result was (year, month, day): 109, 3, 3 > > Has nothing to do with today's date components. Am I missing > something? > > Do I have to convert from date.getTime()? > > > On Apr 16, 3:30 am, Salvador Diaz wrote: >> Even though those Date methods are deprecated, you really have no >> other options to get the date fields. You'll have deprecation >> warnings >> all over the place, but until something like joda-time gets ported to >> GWT there's simply no other way >> >> Cheers, >> >> Salvador >> >> On Apr 16, 10:12 am, "tony.p.." wrote: >> >>> Hi, >> >>> How do I get date components, eg: Month, Day, Year, from datepicker? >>> Since those are deprecated in Java Date and Calendar is not included >>> in GWT. I couldn't find a way nor any post about this issue. >> >>> Thank you, >>> Tony > > --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: date picker date components
Thank you Jason, I was thinking epoch time (1970), that is why the 109 number seemed wrong, it works now. On Apr 16, 12:36 pm, Jason Essington wrote: > Have a look at the Date api? > > getYear() returns the number of years since 1900, so 109 represents > 1900+109=2009 > getMonth() returns the month, 0 = January, 11 = December > getDay() returns the day of the week, 0 = sunday ... 6 = saturday > > and getDate() returns the day of the month (this one is actually what > you would expect, 1 = 1st, 31=31st) > > -jason > > On Apr 16, 2009, at 11:24 AM, tony.p.. wrote: > > > > > Thank you Salvador, I tried it, got wrong results: > > > Date date = (Date) event.getValue(); > > int year = date.getYear(); > > month = date.getMonth(); > > day = date.getDay(); > > > the result was (year, month, day): 109, 3, 3 > > > Has nothing to do with today's date components. Am I missing > > something? > > > Do I have to convert from date.getTime()? > > > On Apr 16, 3:30 am, Salvador Diaz wrote: > >> Even though those Date methods are deprecated, you really have no > >> other options to get the date fields. You'll have deprecation > >> warnings > >> all over the place, but until something like joda-time gets ported to > >> GWT there's simply no other way > > >> Cheers, > > >> Salvador > > >> On Apr 16, 10:12 am, "tony.p.." wrote: > > >>> Hi, > > >>> How do I get date components, eg: Month, Day, Year, from datepicker? > >>> Since those are deprecated in Java Date and Calendar is not included > >>> in GWT. I couldn't find a way nor any post about this issue. > > >>> Thank you, > >>> Tony --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---