資源描述:
《java8新特性探究(七)深入解析日期和時(shí)間-jsr310-java開發(fā)java經(jīng)驗(yàn)技巧》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、Java8DAi0DOi%%££??圧B£?E沱e%盛淀:0圧鎧土%注JSR310?士商^WAEdJava8DAI0DOI^%i£2EB£?EiEei6aidEO2EU°IE±^a-JSR310OiA3dz
2、£°3EEipAA?A?3iep入2?J???????????、~"八XXN八OUEtiOUOa£「EO圧UECEIOpAB%?%^Ead?5d10%upA2id£-Eio!2E6dp6
3、6A3IDd(
4、[%Dedaz;AiE±%aiEiai£6
5、6A3iDdDedadapA
6、j±Qo
7、jAE±,4apaonAd?i6E±%aMa£-i6DE
8、±EuA(;?1±0De%^EadaA,/ii6E±^aMadO^apAA-^^ifp^avaOOQ^AEdyEUxd.-i^iEE^nDAAEf-idAQlEAqA2八、??/sUO?IAj£IA2Ujava.util.Date4uCalendarTiagoFernandezxdiyd?zil(
9、[^±£-Ni%UxiAApAJAVAAPI£-iAApUO?
10、jAEJB2.X£-ipU(]IppA%IEQEO^UAPli£2Upad?xi^aE%pAE±od£-Date%Eda3Dd0Ed^UDAi0£-6odaxdEdWd?%aMAxa??£
11、^?idaxd2?BEO2EUnEViixAIOE%£^O°Od!6L±d6£-2?(][?p¥d?doOd£-.AaAeAeOapAA6£/注6冊(cè)玄?巾巾£?°6AZZOJDK1.1右咗%述處0。000右仏總£。?E,OACalcndarAaEpldEd?EU0IE±%axd(
12、[IO?%axa>>>>£>>?E^ADateFormatAaAE!4?_oI0IdE02£Ux0ux?£??(
13、
14、0DateO?6AA^Dd0Ed/ElJolE±%aDA^i£O?6DDatedDpAia6!-,z4--dN42Eui£2?1y£-iIPAUE(;
15、Date£-i?1E^Calendar£-(
16、[%6AxAi?2?Iz4±aAE£-daEQAPIA?6DEe,4/E°A
17、iAp0^i£2伽J)右OpupAyear°ImonthDatedate=newDate(2012,1,1);System.out.printin(date);Ea3dThuFeb0100:00:00CST3912,U2iEa3o^a1u£-iyearEQ2012+1QOOf^monthl-iOA-Y^Eyld2^50AE1Ad£iOoA'Ea^lDOAfFebfOAEfi6
18、>Ad06DEE^EBAa£-E91uAadaE
19、edAEd^U£-6
20、>AE1OAjava.util.Calendar£-'indaNu...Calendarcalendar=Calendar.getInst^nce();calendar?set(2013,8,2);OaNuDW^^OAEf-calendarpAmonthd^^OO^^^pAf-iii^OAYOLAOAVda,oEyxOf^A^I^E^aOAA^Ucalendar.set(2013,Calendar.AUGUST,2);x^OaEIA^pAuAe£-iCalendarAe-YpAx?dM2?Deda,46E¥1900£-
21、j±
22、E?dAYMA(]rdaoIDate?1EQO?Nu£?£-idadd2?d?dAO^EQEAEEx¥in£i6DD?EE^EAUdapA£-Calendaria10
23、jAAPIE^IBM%e3dE¥
24、iA£-Eudd2A
25、j%dA2?O?OAi£2UpaEyjava.util.DateOejava.util.CalendardDpAEuODEoDO^I^EQ^EiapAIAA^pAuAe£-,%2EEaA力^EO^UO?%apAIiEy....publicstaticvoidmain(String[]args){Calendarbirth=Ca
26、lendar.getInstance();birth.set(1975,Calendar.MAY,26);Calendarnow=Calendar.getInstance();System.out.printin(daysBetween(birth,now));System.out?printin(daysBetween(birth,now));//IOE^0£乙}publicstaticlongdaysBetween(Calendarbegin,Calendarend){longdaysBetween=0;while(begin.before(
27、end)){begin?add(Calendar.DAY_OF_MONTH,1);daysBetween++;}returndaysBe