- 1、本文档共17页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Java中Date类和Calender类的比较(国外英文资料)
Java中Date类和Calender类的比较(国外英文资料)
1, the Date class
In JDK1.0, a representative of the the Date class is the only time the class, but because of the Date class is not convenient to realize internationalization, so from the beginning of the JDK1.1 version, it is recommended to use the Calendar class time and Date processing. Heres a quick introduction to the use of the Date class.
Use the Date class to represent the current system time
Date d = new Date ();
System. The out. Println (d);
Using the Date classs default constructor to create the object representing the current time, due to the Date class covered the toString method, so you can direct the output Date type of object, according to the result is as follows:
Sun Mar 08 16:35:58 CST 2009
In this format, the Sun represent Sunday (Sunday), Mar on behalf of the March (March), 08 on behalf of the no. 8, CST on behalf of the China Standard Time (China Standard Time, that is, eight area (east) Beijing Time).
Use the Date class to represent the specified time
Date d1 = new Date (2009-1900,3-1, 9);
System. The out. Println (d1);
Using constructor with parameters, can construct the Date class object for a specified Date, the Date class in the parameters of the year should be the actual needs, on behalf of minus 1900 years, the actual needs, on behalf of the month after minus 1 value. For example, the above example code is on March 9, 2009.
The actual date, which represents a specific time of year, is similar to this.
Get the information in the Date object
Date d2 = new Date ();
/ / year
Int year = d2. GetYear () + 1900;
/ / in
Int month = d2. GetMonth () + 1;
/ / date
Int date = d2. GetDate ();
/ / hour
Int hour = d2.
/ / minute
Int minute = d2.
/ / SEC.
Int second = d2.
What day / /
Int day = d2.
A. out.println ( year: + year);
A. out.println ( month: + month);
A. out.println ( date: + date);
A. out.println (hour: + hour)
A. out.println ( minute: )
A. out.println ( second );
A. out.println ( week: + day);
Use the Date c
您可能关注的文档
- A4 1.8(国外英文资料).doc
- a goodbye kiss(国外英文资料).doc
- ABAQUS错误提示信息(国外英文资料).doc
- a4不干胶标签打印纸(国外英文资料).doc
- ABBS调查(国外英文资料).doc
- abs的基本机构和故障分析(国外英文资料).doc
- ACL和反掩码(国外英文资料).doc
- Access语句大全(国外英文资料).doc
- adobe premiere 使用技巧(国外英文资料).doc
- AE快捷键(国外英文资料).doc
- 2024年证券分析与咨询服务项目投资申请报告代可行性研究报告.docx
- 2024年铬酸酐项目资金申请报告代可行性研究报告.docx
- 2024年清洁胶项目资金申请报告代可行性研究报告.docx
- 2024年肉松饼项目投资申请报告代可行性研究报告.docx
- 2024年陆上泵项目资金需求报告代可行性研究报告.docx
- 2024年未硫化复合橡胶及其制品项目资金需求报告代可行性研究报告.docx
- 2024年精密温控节能设备项目资金筹措计划书代可行性研究报告.docx
- 2024年汽车覆盖件模具项目资金筹措计划书代可行性研究报告.docx
- 宋词行书钢笔字帖.pdf
- 我的暑假生活作文三年级300字10篇.pdf
文档评论(0)