Atitit. Get the Beijing Time CST feature API summary O7

Source: Internet
Author: User
Tags cst time

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 native time    setsystime : The command line that is called can only support windows Span style= "Font-family:times New Roman" >linux system 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 of the 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 need to delete these days ...


8. The operation of the lost ten days in Java is in accordance with the pope's order of 4.

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

Ten.----Code 5

11. References: 5

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

First of all. The 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 formats now according to pattern ("Yyyy-mm-dd HH:mm:ss"). If you want to support CST time, specify the time zone before you format the date data. Like what:

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

In addition, you can change the local time zone information by using the following code, for example:

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

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

      url Span style= "COLOR: #707070" >  url = new   url ( "" ) ; //gets the resource object   

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

UC. Connect (); //Send connection

         long   ld = uc getdate () ;   //gets the 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 to invoke. can only supportWindowsand theLinuxsystem

3. Note:  1582yearsTenMonth5Day-1582yearsTenMonth -Day.

is not present.

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.

。 As of 16th century, 11 minutes and 14 seconds a year have accumulated 10 days, that is, the calendar more than 10 days. This has caused serious difficulties in determining Easter and has had to take remedial measures.

In 16th century, Pope Gligorij VIII made a correction

For this Gligorij took 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). The Committee was requested to propose a solution.

The Committee started its work in 1587.

。 Kravis suggested using the official statement to erase the 10 days. Pope Gregorio VIII was promulgated on February 24, 1582 by Pope's instructions and erased from October 5, 1582 to 14, and the 10 days disappeared. 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, Julian's calendar is now 10 days fast. 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 on February 24, 1582 by Pope's instructions. The October 5, 1582 to 14 erased, so the 10 days disappeared, gone forever. October 4, 1582 was over, and the next day was October 15. So the calendar is back in sync with the solar year.

The second issue is the need to propose additional rules for the calendar, not to accumulate more than 11 minutes and 14 seconds a year.

So the Kravis committee proposed a 365.2422-day programme for the year. This is much closer to the reality of the celestial movement than the 365.25 days of the Julian calendar. Accordingly, the Julian calendar has only "four years a leap" simple rules to correct: four years a leap, but the turn of the century ' 00, such as 100 years, 200 years, not leap, that is, every 100 years less leap. Such a calculation, the leap year is too small, so further regulation: every four centuries of the turn of the century. That is, 400 years, 800 years is still a leap

5. Different countries of the calendar

The Gligorij calendar was 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. British talent figured out that rationality eventually prevailed, but from 1582 until then, the calendar was 1 more days, so the British Parliament made a decision in 1752. Erase 11 days----from September 3, 1752 to 13th, Gligorij reform was accepted.

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. Because the new calendar was issued by the pope, the Protestant state resisted.

Until September 2, 1752, the Daying Empire, which included England , Scotland, and now part of the United States , was Nagrile, so that it jumped from September 2 to September 14 directly, and the date skipped 11th.

Sweden plans to change from the Julian calendar to the Gregorian calendar in 1699, and is scheduled to cancel all leap years from 1700 to 1740. That is, in the period February is only 28 days, the equivalent of the Swedes are going to spend 40 years to finish someone else in two days to achieve the effect.

The last of the Eastern European countries with the Gregorian calendar is Greece . 1923.

But it was all private use--the national church was not accepted.

6.1582yearsTenMonth thethe date of the event that occurred before the date is notAble to reverse the current calendar

In ordinary documents, the date of the event that occurred before October 15, 1582 is still expressed as 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 to remove thisTenDays..

8. Javain the loss of thisTenThe operation of the heavens is in accordance with the pope's orders

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. Butjava1.6of thetimestampis wrong,Bug

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



11. References:

"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

Atitit. Get the Beijing Time CST feature API summary O7

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.