java.util.Date

来源:互联网 发布:推广网站源码 编辑:程序博客网 时间:2024/04/29 00:06

java.util 
Class Date

java.lang.Object  extended byjava.util.Date
All Implemented Interfaces:
Cloneable, Comparable, Serializable
Direct Known Subclasses:
Date, Time, Timestamp

public class Date
extends Object
implements Serializable, Cloneable, Comparable

The class Date represents a specific instant in time, with millisecond precision.

这个类指定了一个时间,用毫秒表示

Prior to JDK 1.1, the class Date had two additional functions. It allowed the interpretation of dates as year, month, day, hour, minute, and second values. It also allowed the formatting and parsing of date strings. Unfortunately, the API for these functions was not amenable to internationalization. As of JDK 1.1, the Calendar class should be used to convert between dates and time fields and the DateFormat class should be used to format and parse date strings. The corresponding methods in Date are deprecated.

在jdk1.1前,这个类附加了两个功能,它允许时间有年月日时分和秒的值。它也允许用字符串格式化时间。

不幸地,是它不这些API函数不支持国际化。jdk1.1,calendar类可以用来转换在日期和时间字段,和DateFormat类可以用来转换

时间字符传,对应的方法在date是被定义的

Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern(现代的) operating systems assume that 1 day = 24 × 60 × 60 = 86400 seconds in all cases. In UTC, however, about once every year or two there is an extra(额外的) second, called a "leap second." The leap second is always added as the last second of the day, and always on December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. Most computer clocks are not accurate enough to be able to reflect the leap-second distinction.

通过这个date类得到的时间,它也许不是精确的,依赖在这java虚拟机。几乎现在的操作时间是:

1day=24x60x60=86400秒。然而,每隔一两年就有额外的秒,它总是加到这天的最后秒上,

和一直在12月的号或者6月的30号,例如,这1995年最后一分钟是61秒长,由于加了跳跃的妙。

大多数计算机的钟都不能精确的反应leap-second的区别

Some computer standards(规定) are defined in terms of Greenwich mean time (GMT)

大多数计算机规定的是格林威治时间