- 1
- 0
- 约9.36千字
- 约 42页
- 2018-01-05 发布于河南
- 举报
第五章--java基础类的应用
* Date 类 Date 类表示日期和时间 提供操纵日期和时间各组成部分的方法 Date 类的最佳应用之一是获取系统当前时间 * Date 类构造方法 构造方法 说明 Date() 使用当天的日期创建 Date Date(long dt) 使用自 1970 年 1 月 1 日以后的指定毫秒数创建 Date void display() { String strDate , strTime = ; System.out.println(“今天的日期是: + objDate); long time = objDate.getTime(); System.out.println(“自 1970 年 1 月 1 日起 + “以毫秒为单位的时间 (GMT): + time); strDate = objDate.toString(); // 提取 GMT 时间 strTime = strDate.substring(11 , (strDate.length() - 4)); // 按小时、分钟和秒提取时间 strTime = “时间: + strTime.substring(0 , 8); Syst
原创力文档

文档评论(0)