<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>


    posts - 15,  comments - 34,  trackbacks - 27

    A Date object represents a precise moment in time, down to the millisecond. Dates are represented as a long that counts the number of milliseconds since midnight, January 1, 1970, Greenwich Mean Time.

    Does this have a year 2000 problem? If so in what year?

    To create a Date object for the current date and time use the noargs Date() constructor like this:

    Date now = new Date();

    To create a Date object for a specific time, pass the number of milliseconds since midnight, January 1, 1970, Greenwich Meantime to the constructor, like this:

    Date midnight_jan2_1970 = new Date(24L*60L*60L*1000L);

    You can return the number of milliseconds in the Date as a long, using the getTime() method. For example, to time a block of code, you might do this

    Date d1 = new Date(); // timed code goes here Date d2 = new Date(); long elapsed_time = d2.getTime() - d1.getTime(); System.out.println("That took " + elapsed_time + " milliseconds");

    You can change a Date by passing the new date as a number of milliseconds since midnight, January 1, 1970, GMT, to the setTime() method, like this:

    Date midnight_jan2_1970 = new Date(); midnight_jan2_1970.setTime(24L*60L*60L*1000L);

    The before() method returns true if this Date is before the Date argument, false if it's not. For example

    if (midnight_jan2_1970.before(new Date())) { 

    The after() method returns true if this Date is after the Date argument, false if it's not. For example

    if (midnight_jan2_1970.after(new Date())) { 

    The Date class also has the usual hashCode(), equals(), and toString() methods.

    posted on 2005-02-04 11:39 jacky 閱讀(128) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(10)

    隨筆檔案

    文章分類

    文章檔案

    相冊

    收藏夾

    java

    搜索

    •  

    最新評論


    主站蜘蛛池模板: 亚洲日日做天天做日日谢| 久久噜噜噜久久亚洲va久| 亚洲va成无码人在线观看| 一级毛片在线免费看| 亚洲综合精品香蕉久久网97| 日韩免费人妻AV无码专区蜜桃| 亚洲国产精品久久久天堂| 久久免费高清视频| 色婷婷六月亚洲婷婷丁香| 99热在线精品免费播放6| 亚洲欧洲国产综合| 久久久久国色AV免费观看性色 | 最近的免费中文字幕视频 | 国产成人精品免费视频软件| 亚洲AV无码国产一区二区三区| 国产免费久久精品| 一区二区三区免费在线视频| 国产成A人亚洲精V品无码性色 | 好湿好大好紧好爽免费视频| 久久亚洲国产欧洲精品一| 久久久精品2019免费观看| 亚洲国产日韩女人aaaaaa毛片在线 | 亚洲精品精华液一区二区 | 波多野结衣免费在线| 亚洲自偷自偷在线成人网站传媒 | 国产免费私拍一区二区三区| g0g0人体全免费高清大胆视频| 亚洲中文字幕第一页在线| 99热精品在线免费观看| 久久亚洲AV成人无码国产最大| 亚洲乱码日产精品a级毛片久久| 国产免费一区二区三区在线观看| 亚洲午夜国产精品| 亚洲精品专区在线观看| 中文字幕在线观看免费视频| 亚洲6080yy久久无码产自国产| 亚洲乱码中文字幕久久孕妇黑人| 在线观看H网址免费入口| 真正全免费视频a毛片| 亚洲成A人片777777| 国产精品国产午夜免费福利看|