Atitit. Get the Beijing Time CST feature API summary O7

Source: Internet
Author: User
Tags cst time time zones

Atitit. Get Beijing Time CST function API Summary O7

1. Get CST time ( Beijing time ) two cloth:1. Crawl URL Timtstamp >>format to the CST 1

2. Set the native time setsystime(date); : Called command line, only supported for Windows and Linux Systems 2

3. Note : 1582 5 days , -1582 years , ten months days. is not present : 2

4. The Kravis committee faces two different problems, the solar year is inconsistent with and leap years 3

5. Different countries do not have the same calendar 3

6. The date of the event that occurred prior to the 1582 year cannot be reversed by the current calendar 4

7. For determining the number of days interval needs to be deleted ... 4

8. The operation of the lost ten days in Java is in accordance with the papal Order of 4

9. But java1.6 's timestamp is wrong,bug 4

Ten.----Code 5

11. Reference: 5

1. GetCSTTime(Beijing Time)Two cloth:1.CrawlURL Timtstamp >>formatto theCST

First, Java.util.Date represents a point-in-time UTC time, which is the number of milliseconds from 00:00:00 A.D. January 1, 1970. So it's not a time zone or locale concept.

By default, SimpleDateFormat gets the time zone of the local system and then formats now with the pattern ("Yyyy-mm-dd HH:mm:ss"). If you want to support CST time, specify the time zone before formatting the date data. For example:

SimpleDateFormat SDF = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");

Sdf.settimezone (Timezone.gettimezone ("gmt+8"));
String snow = Sdf.format (now); 2009-11-19 14:12:23

Alternatively, you can modify the local time zone information by using the following code:

Timezone.setdefault (Timezone.gettimezone ("gmt+8"));

Calendar calculations are also time-zone-based, for example: the number of hours in different time zones for the same date is not the same. But Calendar.gettime (); The returned date is not a time zone, because it is of type date.

url url = new URL ("HTTP// "); //Get Resource object

urlconnection uc=url. OpenConnection (); //Build Connection Object

UC. Connect (); //Send connection

         long   ld = uc getdate () ;   //get site Date time (timestamp)   

Date date = new Date (LD c10>); //Convert to Standard Time object

Timezone.setdefault (Timezone.gettimezone ("gmt+8"));

System. out . println (dateutil. tostandfmtyyyymmdd_hhmmss_bydate (date)) ;

Author:: Old Wow's paw attilax Ayron, email:[email protected]

Reprint please indicate source: Http://

2. Set the native time  Setsystime(Date);: The command line that is called, can only supportWindowsand theLinuxsystem

3. Note:  1582yearsTenMonth5Day-1582yearsTenMonth -Day. It doesn't exist...

The vernal equinox's date on the Julian calendar is getting more and more advanced, which is inconvenient for the farming season, and the church is sure to bring trouble on which day of Easter.

。 Because by 16th century, 11 minutes and 14 seconds a year have accumulated 10 days, that is, the calendar more than 10 days, which to determine the serious difficulties of Easter, have to take measures to remedy. In 16th century, Pope Gligorij VIII made a correction

To this end, Gligorij has adopted the oldest and most effective strategy to solve such problems----he convened a committee to appoint a wise chairman, the distinguished Jesuit mathematician Clisdorfer Clavis (Christopher Clavius), to ask the Commission to propose a solution. The Committee began its work in 1587.
。 Kravis recommends using official statements to erase these 10 days! Pope Gregorio VIII was promulgated by the Pope on February 24, 1582 and erased from October 5, 1582 to 14, and the 10 days were gone. October 4, 1582 is over, the next day is October 15.

4. The Kravis committee faces two different problems, the solar year is inconsistent and leap years

First, the Julian calendar is now 10 days away and must be pulled back in line with the solar year. Kravis recommends using official statements to erase these 10 days! Pope Gregorio VIII was promulgated by the Pope on February 24, 1582 and erased from October 5, 1582 to 14, and the 10 days were gone. October 4, 1582 is over, the next day is October 15, so the calendar is back to the sun and the year in sync.

The second issue is the need to propose additional rules for the calendar, not to accumulate too much 11 minutes and 14 seconds more each year. So the Kravis committee proposed a 365.2422-day plan for the year, which was much closer to the reality of the celestial movement than the 365.25 days of the Julian calendar. According to the Julian calendar only "four years a leap" simple provisions to correct: four years a leap, but the turn of the century ' 00, such as 100 years, 200 years, do not leap, that is, every 100 years less leap. Such a calculation, leap year is too little, so further regulations: every four centuries of the turn of the century, that is, 400 years, 800 years is still a leap

5. Different countries do not have the same calendar

The Gligorij calendar was soon widely accepted in the Roman Catholic sphere, but in Britain it caused a cacophony of objections, and the British still insisted on the Julian calendar, refusing to "erase 10 days". Until 1752, the British talent figured out, rationality finally prevailed, but from 1582 to then, the calendar 1 more days, so the British Parliament in 1752 to make a decision to erase 11 days----September 3, 1752 to 13th, and then accepted the Gligorij reform

But after the promulgation of Gregory 13 's new calendar, only the then Catholic countries Italy , Poland, Spain , Portugal began to use the new calendar, October 4, 1582 after the 10th skipped. Since the new calendar was issued by the pope, the Protestant state resisted. Until the Julian calendar September 2, 1752, the Daying Empire, including England , Scotland, and now a part of the United States to adopt Gregorian calendar, so the day after the jump straight from September 2 to September 14, the date skipped 11th.

Sweden plans to change from the Julian calendar to the Gregorian calendar in 1699, and the plan is to cancel all leap years from 1700 to 1740, which is only 28 days in February, which is equivalent to the Swedish plan to spend a 40-year period to achieve the effect that someone else will have in two days.

The Eastern European countries that adopted the Gregorian calendar last year were Greece , 1923. But it was all folk adoption--the national church was not accepted.

6.1582yearsTenMonth thethe date of the event that occurred before the date is notIt can be reversed by the current calendar

In ordinary documents, the date of events that occurred before October 15, 1582 is still expressed in the date of the Julian calendar that was used, rather than being reversed on the current calendar.

7. For determining the number of days interval you need to delete thisTenThe day ...

8. Javain the loss of thisTenThe operation of the heavens is in accordance with the Pope's command

String d1="1582-10-03";

String d2="1582-10-15";

    int span=Dateutil.Getdayinterval(Dateutil.str2date(D1, false),Dateutil.str2date(D2, false));

System. out . println (span) ;

the output is 2 days.

9. Howeverjava1.6of thetimestampis wrong,Bug

String d1="1582-10-09"; //-12219094800000, -12219008400000-12218922000000



11. Reference:

"java " get Beijing time   from the Internet; Span style= "Font-family:times New Roman" >-  Good to sleep ...   -  blog channel   -

[ reprint ]1582 year 10 month 4 The next day after the day, not 10 month 5 day Oh _ Span style= "font-family: Song body" > Representative Binks's wine _ Sina blog .htm

Questions about the Java Date and time zone - Desert Sea column - Blog channel -CSDN.NET.htm

Atitit. GMT UTC catitit.gmt UTC CST DST CET Week month festive time different nature and origins -attilax column - Blog channel -CSDN.NET.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.