public inbox for java-prs@sourceware.org help / color / mirror / Atom feed
From: "mnefedov at rogers dot com" <gcc-bugzilla@gcc.gnu.org> To: java-prs@gcc.gnu.org Subject: [Bug libgcj/18088] New: Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field. Date: Wed, 20 Oct 2004 19:01:00 -0000 [thread overview] Message-ID: <20041020190131.18088.mnefedov@rogers.com> (raw) Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field -- it should not be adjusted. Here is a sample code. import java.util.Calendar; import java.text.SimpleDateFormat; public class CalendarTest2 { public static void main( String [] args ) { boolean fail = false; Calendar c = Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat( "EEEEEEEEEEEEE, yyyy-MM-dd [DDD] HH:mm:ss.SSSS" ); System.out.println( "Today: " + df.format( c.getTime() ) ); c.set( 2004, 9, 1, 12, 0, 0 ); c.set( Calendar.MILLISECOND, 0 ); System.out.println( df.format( c.getTime() ) ); c.set( Calendar.DAY_OF_MONTH, 2 ); System.out.println( df.format( c.getTime() ) ); c.set( Calendar.DAY_OF_MONTH, 3 ); System.out.println( df.format( c.getTime() ) ); c.set( Calendar.DAY_OF_MONTH, 4 ); System.out.println( df.format( c.getTime() ) ); } } Here is the output with the errors: 1: Today: Wednesday, 2004-10-20 [294] 13:51:47.0592 2: Friday, 2004-10-01 [275] 13:00:00.0000 3: Saturday, 2004-10-02 [276] 13:00:00.0000 4: Sunday, 2004-10-03 [277] 12:00:00.0000 5: Monday, 2004-10-04 [278] 12:00:00.0000 Error #1: line 2: hour was set to 12 not 13. What is interesting in this case -- c.get( Calendar.HOUR ) will give 12 back. SimpleDateFormat() report 13 though. Error #2: line 4: hour is 12 now. -- Summary: Calendar's HOUR field gets adjusted when setting DAY_OF_MONTH field. Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libgcj AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mnefedov at rogers dot com CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18088
next reply other threads:[~2004-10-20 19:01 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-10-20 19:01 mnefedov at rogers dot com [this message] 2004-10-20 19:05 ` [Bug libgcj/18088] " pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20041020190131.18088.mnefedov@rogers.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=java-prs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).