熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java核心技術 >> 正文

java獲取系統時間

2022-06-13   來源: Java核心技術 

  java獲取系統時間代碼
   
    Date d = new Date()
   
    long s = SystemcurrentTimeMillis()
   
    Calendar c=CanlendargetInstance()
   
    結果如下
   
    Systemoutprintln(d)
   
    Systemoutprintln(s)
   
    Systemoutprintln(c)
   
    Tue Aug :: CST
   
   
   
    javautilGregorianCalendar

  [time=areFieldsSet=trueareAllFieldsSet=truelenient=truezone=sunutilcalendarZoneInfo

  [id=Asia/Shanghaioffset=dstSavings=useDaylight=falsetransitions=

  lastRule=null]firstDayOfWeek=minimalDaysInFirstWeek=ERA=YEAR=MONTH=

  WEEK_OF_YEAR=WEEK_OF_MONTH=DAY_OF_MONTH=DAY_OF_YEAR=

  DAY_OF_WEEK=DAY_OF_WEEK_IN_MONTH=AM_PM=HOUR=HOUR_OF_DAY=

  MINUTE=SECOND=MILLISECOND=ZONE_OFFSET=DST_OFFSET=]


From:http://tw.wingwit.com/Article/program/Java/hx/201311/26262.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.