3.Java基础之Date对象

毕向东老师Java基础学习笔记——Date对象

今天学习Java中的Date对象后,感觉这个对象对我们主要有以下几点用处.

1.获取时间和日期并按照自己定义的格式显示。

2.网站设计时显示时间。

 知识点如下:

java.util

Date 表示特定的瞬间,精确到毫秒。

在 JDK 1.1 之前,类 Date 有两个其他的函数。它允许把日期解释为年、月、日、小时、分钟和秒值。它也允许格式化和解析日期字符串。不过,这些函数的 API 不易于实现国际化。从 JDK 1.1 开始,应该使用 Calendar 类实现日期和时间字段之间转换,使用 DateFormat 类来格式化和解析日期字符串。Date 中的相应方法已废弃。

java.text

类 DateFormat

DateFormat 是日期/时间格式化子类的抽象类,它以与语言无关的方式格式化并解析日期或时间。日期/时间格式化子类(如 SimpleDateFormat)允许进行格式化(也就是日期 -> 文本)、解析(文本-> 日期)和标准化。将日期表示为 Date 对象,或者表示为从 GMT(格林尼治标准时间)1970 年 1 月 1 日 00:00:00 这一刻开始的毫秒数。

3.Java基础之Date对象

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABC4AAAAmCAIAAACEUU2PAAAEmElEQVR4nO3du43rRhQGYLXFDtQEu1DKQgZQAQ4cMlcDKsAZYwPuQQ74Jofk8LFX18Z38CW7y4dWEX+cM5zbZ1D//P3Xn38EAACAH1KHjs/nc5tHkff7AwAA8BNEEQAA4AtEEQAA4AtEEQAA4At+2yhShfAKoUo9vqzKsiq//W0CAACJzkeRV3673W63W/7ac+OqyO5Z9ghrB9yaC4c9HyN7ltHfp15np/CI3RQAANhwSVeke9xfiRbLZ8UzTBNFsqLac7V7UUb+GvLZjWZdlLK4386UNAIAAHtcM6DVPcfv6zzULYX4WVdGkany2XZctrJTc2R72OTH/jDjYQAAsM9Va0VeeXbPop2BOm/EWx9NYyQPnzK8QngNTj8eRZL6G9mzfL9CeIX17JQYRQAAgJ0So0i/cuN4rS0mmS9Sn0aRZshqMQb0a0KG92rOqjNS04RZDxL1fdvuyloUab8To1kAALDfZcvWN9oX6yNM7aTWRpYJr6J4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//xts9lsNpvNZrPZbLfeBsnkf//912az2Ww2m81ms9luvQ2SCQAAwD1JJgAAQD3JBAAAqCeZAAAA9SQTAACg3v8BwGc2lcB52CAAAAAASUVORK5CYII=" alt="" />
public class SimpleDateFormat extends DateFormat

     SimpleDateFormat 是一个以与语言环境有关的方式来格式化和解析日期的具体类。它允许进行格式化(日期 -> 文本)、解析(文本 -> 日期)和规范化。SimpleDateFormat 使得可以选择任何用户定义的日期-时间格式的模式。但是,仍然建议通过 DateFormat 中的 getTimeInstancegetDateInstancegetDateTimeInstance 来创建日期-时间格式器。每一个这样的类方法都能够返回一个以默认格式模式初始化的日期/时间格式器。可以根据需要使用 applyPattern 方法来修改格式模式。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABDUAAADhCAIAAABX8hmcAAAgAElEQVR4nO2dwXHjOrOFlZYzuEk4i9k6EFdNAP/iX3o/CdwA3m7Wr+rloLewJVNA98FpkJRo+/vq1C0KBLobAH3dPSTl0xkAAAAAAOAYnB4dAAAAAAAAwAfUJwAAAAAAcBSoTwAAAAAA4CgE9cn//e//IIQQQgghhNCu+u9/Xt365L//eUUIIYQQQgihnVSuT/7994wQQgghhBBCe4j6BCGEEEIIIXQUUZ8ghBBCCCGEjiLqE4QQQgghhNBRtFV98uf19c/ra3Dq7e3v29vfh89zT/19ff3z+mrP8e3v29vft8eHjRBCCCGE0OG0VX3y9+XpdDqdTqd/Xt7C9tNzVL3c6s/Ly++Xl7+iw/OHsV+vM7O9DH/+Uxn19+Xpn6cn4bE0x0UYT7/fwnbXTlGvvyKnCCGEEEIIHUgb1ydPTXXx9vs9dW/bE729/BMk6O9Gnn6/XbysSN/nKhxd2CRzH1hrCrkPvT53jrr7LddVmoQSBSGEEEIIHVU71yfv/2ZfKQY+EvRl+v5h5HR6/r26PklKoKEuMUSjtqxPWl0KvPEafvS8dGs+fnbj6TKEEEIIIXRc7VufvBcbQeL+9vspS9C7SmBh5Ob+yUelUb4b8Of56Z+ncNS76/gmycctlO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H6BAAAAAAAjkKtPkEIIYQQQgihXeXWJ//9zytCCCGEEEII7S2rPgEAAAAAAHgI1CcAAAAAAHAUqE8AAAAAAOAoUJ8AAAAAAMBRoD4BAAAAAICjQH0CAAAAAABHgfoEAAAAAACOAvUJAAAAAAAchf8H2w8dvgixiDMAAAAASUVORK5CYII=" alt="" />

日期和时间模式

日期和时间格式由日期和时间模式 字符串指定。在日期和时间模式字符串中,未加引号的字母 'A''Z''a''z' 被解释为模式字母,用来表示日期或时间字符串元素。文本可以使用单引号 (') 引起来,以免进行解释。"''" 表示单引号。所有其他字符均不解释;只是在格式化时将它们简单复制到输出字符串,或者在解析时与输入字符串进行匹配。

定义了以下模式字母(所有其他字符 'A''Z''a''z' 都被保留):

字母 日期或时间元素 表示 示例
G Era 标志符 Text AD
y Year 1996; 96
M 年中的月份 Month July; Jul; 07
w 年中的周数 Number 27
W 月份中的周数 Number 2
D 年中的天数 Number 189
d 月份中的天数 Number 10
F 月份中的星期 Number 2
E 星期中的天数 Text Tuesday; Tue
a Am/pm 标记 Text PM
H 一天中的小时数(0-23) Number 0
k 一天中的小时数(1-24) Number 24
K am/pm 中的小时数(0-11) Number 0
h am/pm 中的小时数(1-12) Number 12
m 小时中的分钟数 Number 30
s 分钟中的秒数 Number 55
S 毫秒数 Number 978
z 时区 General time zone Pacific Standard Time; PST; GMT-08:00
Z 时区 RFC 822 time zone -0800

范例源码如下:

/********************************

   Date对象在java.util包中

   DateFormat在java.text包中

********************************/
import java.text.*;
import java.util.*;
class DateDemo
{
public static void main(String[] args)
{
Date d=new Date();
System.out.println(d);//打印的时间看不懂,希望有些格式。 //将模式封装到SimpleDateFormat对象中。
SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日"); //调用format方法格式化指定Date对象。 String time =sdf.format(d);
System.out.println("time="+time);
}
}

程序运行截图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAApoAAACjCAIAAAClhCnkAAAOu0lEQVR4nO3dS/Bk1V0H8B4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FBmBd+VW4xSw3BSN9+bJ2pDsH2Iz8ZvtilpiCfU+/A8A5uvPFCFoA1oDuHACypzsHgOzpzgEge7pzAMie7hwAsqc7B4Ds6c4BIHu6cwDInu4cALKnOweA7OnOASB7unMAyJ7uHACypzsHgOzpzgEge7pzAMie7hwAsqc7B4Ds6c4BIHu6cwDI3rK78+lkrhY6tIVXAICtYYTuvIjhxDyOzJHoAJBghM/OyxlcyePGrj2e2RIdALqM2Z1P0uK8Pq3XvQCw5a22O48diEQHgIFW253HtU2W5QAQtQafnU9qE+IjAMC81V7ZnvIFtsHNPQBsVWv5vfP277k92mL4CwAA+cvsV+HEOQDUZfab7eIcAOp05wCQvcy6cwCgLrPuHACo050DQPZ05wCQPd05AGRPdw4A2dOdA0D2dOcAkD3dOQBkT3cOANnTnQNA9nTnAJA93TkAZE93DgDZ050DQPZ05wCQPd05AGRPdw4A2dOdA0D2dOcAkD3dOQBkT3cOANnTnQNA9nTnAJA93TkAZE93DgDZ050DQPZ05wCQPd05AGRPdw4A2dOdA0D2dOcAkD3dOQBkT3cOANnTnQNA9nTnAJA93TkAZG/B7vz/AYP71s6T0y7HAAAAAElFTkSuQmCC" alt="" />

上一篇:HTML如何转XTML


下一篇:一个基于DDD的开源项目,各种技术!