473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

I don't think GregorianCalendar.setChangeDate works

1 New Member
I see the expected 11 day gap for the default ChangeDate but when I change it to the English change date, I don't see the expected 12 day gap. Any advice?
Expand|Select|Wrap|Line Numbers
  1. import java.text.DateFormat;
  2. import java.util.*;
  3. public class SetGregorianChangeDate {
  4.  
  5.     /**
  6.      * @param args
  7.      */
  8.     public static void main(String[] args) {
  9.         DateFormat df = DateFormat.getDateInstance();
  10.         df.setTimeZone(TimeZone.getTimeZone("GMT"));
  11.  
  12.         GregorianCalendar  gc = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
  13.         System.out.println("Get default change date in GMT:" 
  14.           + df.format(gc.getGregorianChange().getTime()));        
  15.         System.out.println("Get day before default change date in GMT (Expect 11 day gap Oct 4, 1582):" 
  16.           + df.format(gc.getGregorianChange().getTime() - 24*60*60*1000));
  17.  
  18.         gc = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
  19.         gc.set(1752, 9 - 1 , 14, 0, 0, 0);
  20.         gc.setGregorianChange(gc.getTime()) ;
  21.  
  22.         System.out.println("Get new change date in GMT:" 
  23.           + df.format(gc.getGregorianChange()));        
  24.         System.out.println("Get new day before default change date in GMT (Expect 12 day gap Sep 2, 1752) :" 
  25.           + df.format(gc.getGregorianChange().getTime() - 24*60*60*1000));
  26.     }
  27. }
Get default change date in GMT:Oct 15, 1582
Get day before default change date in GMT (Expect 11 day gap Oct 4, 1582):Oct 4, 1582
Get new change date in GMT:Sep 14, 1752
Get new day before default change date in GMT (Expect 12 day gap Sep 2, 1752) :Sep 13, 1752
Jun 28 '11 #1
0 1622

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2463
by: Ryan R. Rosario | last post by:
Hi - **I apologize for posting this again. I dont think my first one went thru** I am in the process of converting a table based website over to a CSS based website and I am having a problem....
3
1203
by: Guhanath | last post by:
Dear All, Is dot.Net Framework processor based and mainly targetted at Pentium machines??Will it work in AMD Processor especially AMD Athlon 64 Processors. -- Guhan
0
1071
by: Rahmi Acar | last post by:
http://finalgate.ath.cx it got a simple search engine and you might try it out search for syntax description based on i.e. int, else, if, do and so on it will then return to a page containing a...
19
2871
by: Wouter | last post by:
Hi, I try to make when i send a <form> that he dont open a new window. Is there someone who know how i can make this whit javascript ? Greets Wouter
0
944
by: richard | last post by:
Try using windows terminal service
10
1990
by: free2cric | last post by:
Hi, FOllowing is a program which is written by someone else. Its output is a wonderful poem. I dont understand how it works really. can anyone tell. thanks cric #include <stdio.h> main(int...
24
7621
by: Jazper | last post by:
hi i have this problem. i made a class deverted by CRootItem with implementation of IDisposable-Interface. i made a test-funktion to test my Dispose-Method.... but when set a breakpoint in my...
1
1759
by: rcamarda | last post by:
I was looking through our vendors views, searching for something I needed for our Datawarehouse and I came across something I do not understand: I found a view that lists data when I use it in...
19
2224
by: so many sites so little time | last post by:
the table is head the colunm is called body <?php //show_site.php // This script retrieves blog entries from the database. // Address error handing. ini_set ('display_errors', 1);...
4
1465
by: piercy | last post by:
Ive been developing a program for a while nwo and am wanting to release the version ive been working on. now before i do i need to test on a few other machines than my own. So at my work we have a...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.