Because the first argument of Date(int, int, int) is added to 1900 to make the year. Use 99 for the year to get 1999.
On Wed, Jul 8, 2009 at 4:54 AM, hjo1620<[email protected]> wrote: > > Regarding GWT1.6. > > This test: > > package com.google.gwt.i18n.client; > import java.util.Date; > import com.google.gwt.junit.client.GWTTestCase; > > public class DateTimeFormatTest extends GWTTestCase { > private String pattern = "yyyy'-'MM'-'dd"; > private DateTimeFormat format = DateTimeFormat.getFormat(pattern); > > public void testShouldFormatDateToYYYYDashMMDashDD() throws Exception > { > assertToDate("1999-01-01", 1999, 0, 1); > } > > �...@suppresswarnings("deprecation") > private void assertToDate(String expected, int YYYY, int MM, int DD) > { > assertEquals(expected, format.format(new Date(YYYY, MM, DD))); > } > > �...@override > public String getModuleName() { > return "com.google.gwt.user.User"; > } > } > > fails with : > junit.framework.AssertionFailedError: expected=1999-01-01 > actual=3899-01-01 > > > Am I missing something ? > Why is it displaying 19*2=38, instead of 19, as first two digits in > the year ? > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
