隨筆 - 119  文章 - 3173  trackbacks - 0
          <2007年12月>
          2526272829301
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          交友莫獨酒,茅臺西鳳游。
          口干古井貢,心徜洋河流。
          稱多情杜康,趟無量雙溝。
          贊中華巍巍,無此不銷愁。

          常用鏈接

          留言簿(68)

          隨筆分類(136)

          隨筆檔案(122)

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 527185
          • 排名 - 93

          最新評論

          比較有用的一個東西

          ?1?import?java.util.concurrent.TimeUnit;
          ?2?
          ?3?public?class?TimeUnitDemo?{
          ?4?????private?TimeUnit?timeUnit?=TimeUnit.DAYS;
          ?5?
          ?6?????public?static?void?main(String[]?args)?{
          ?7?????????TimeUnitDemo?demo?=?new?TimeUnitDemo();
          ?8?????????demo.outInfo();
          ?9?????????demo.timeUnit?=TimeUnit.HOURS;
          10?????????demo.outInfo();
          11?????????demo.timeUnit?=TimeUnit.MINUTES;
          12?????????demo.outInfo();
          13?????????demo.timeUnit?=TimeUnit.SECONDS;
          14?????????demo.outInfo();
          15?????}
          16?
          17?????public?void?outInfo()?{
          18?????????System.out.println(timeUnit.name());
          19?????????System.out.println(timeUnit.toDays(1));
          20?????????System.out.println(timeUnit.toHours(1));
          21?????????System.out.println(timeUnit.toMinutes(1));
          22?????????System.out.println(timeUnit.toMicros(1));
          23?????????System.out.println(timeUnit.toMillis(1));
          24?????????System.out.println(timeUnit.toNanos(1));
          25?????????System.out.println(timeUnit.toSeconds(1));
          26?????????System.out.println("1天有"+(timeUnit.convert(1,?TimeUnit.DAYS))+timeUnit.name());
          27?????????System.out.println("12小時"+(timeUnit.convert(12,?TimeUnit.HOURS))+timeUnit.name());
          28?????????System.out.println("3600秒有"+(timeUnit.convert(36000,?TimeUnit.MINUTES))+timeUnit.name());
          29?????????System.out.println("-------------------");
          30?????}
          31?}
          32?


          --------------------------
          DAYS
          1
          24
          1440
          86400000000
          86400000
          86400000000000
          86400
          1天有1DAYS
          24小時0DAYS
          3600秒有25DAYS
          -------------------
          HOURS
          0
          1
          60
          3600000000
          3600000
          3600000000000
          3600
          1天有24HOURS
          24小時12HOURS
          3600秒有600HOURS
          -------------------
          MINUTES
          0
          0
          1
          60000000
          60000
          60000000000
          60
          1天有1440MINUTES
          24小時720MINUTES
          3600秒有36000MINUTES
          -------------------
          SECONDS
          0
          0
          0
          1000000
          1000
          1000000000
          1
          1天有86400SECONDS
          24小時43200SECONDS
          3600秒有2160000SECONDS
          -------------------


          posted on 2007-12-21 16:53 交口稱贊 閱讀(8630) 評論(1)  編輯  收藏 所屬分類: Java6java相關

          FeedBack:
          # re: 學習Java6(十二)日期工具類TimeUnit 2007-12-24 16:23 塔塔
          應該寫多點吧,還要去查API....- -;
          感覺比較方便,不錯不錯.TimeUnit.  回復  更多評論
            
          主站蜘蛛池模板: 溧水县| 两当县| 临海市| 宁陵县| 宜丰县| 元朗区| 仁化县| 灵寿县| 柳林县| 常德市| 普格县| 民和| 洛隆县| 肃南| 云龙县| 文安县| 辉南县| 高邮市| 南靖县| 榆社县| 普洱| 安化县| 霞浦县| 民勤县| 岗巴县| 孟津县| 奉化市| 麟游县| 宁国市| 广安市| 昌图县| 什邡市| 西城区| 兴业县| 威宁| 兴安盟| 密山市| 蕉岭县| 汉寿县| 普宁市| 崇州市|