public class Date extends Date
在一毫秒的价值,可以确定这是一个JDBC SQL DATE
值薄包装纸。一毫秒的价值代表,1970年1月1日以来通过00:00:格林威治时间0毫秒数
符合SQL DATE
毫秒值的定义,用一个java.sql.Date
实例必须“规范化”通过设置小时,分钟,秒和毫秒到零,在特定的时间区域与该实例相关联。
Constructor and Description |
---|
Date(int year, int month, int day)
过时的。
相反,使用构造函数
Date(long date)
|
Date(long date)
使用给定的毫秒时间价值构建
Date 对象。
|
Modifier and Type | Method and Description |
---|---|
int |
getHours()
过时的。
|
int |
getMinutes()
过时的。
|
int |
getSeconds()
过时的。
|
void |
setHours(int i)
过时的。
|
void |
setMinutes(int i)
过时的。
|
void |
setSeconds(int i)
过时的。
|
void |
setTime(long date)
使用给定的毫秒时间价值的存在
Date 对象集。
|
Instant |
toInstant()
此方法总是总是抛出UnsupportedOperationException,不应该因为SQL
Date 值没有时间成分。
|
LocalDate |
toLocalDate()
将这一
LocalDate
Date 对象
|
String |
toString()
格式的日期格式为YYYY-MM-DD。逃跑日期
|
static Date |
valueOf(LocalDate date)
|
static Date |
valueOf(String s)
转换日期格式的字符串在JDBC逃到
Date 价值。
|
@Deprecated public Date(int year, int month, int day)
Date(long date)
Date
对象与给定的年、月、日初始化。
如果一个给定的参数是不确定的,则结果是不确定的。
year
年减1900;必须在0到8099。(请注意8099是9999减去1900。)
month
- 0至11
day
- 1至31
public Date(long date)
Date
对象。如果给定的毫秒值包含时间信息,司机将设置时间组件在默认时区的时间(在java虚拟机中运行应用程序的时区),相当于零时间。
date
-毫秒自1970年1月1日00:00:00 GMT不超过全年8099毫秒表示。负数表示的毫秒数在1970年1月1日之前,00:00:00 GMT。
public void setTime(long date)
Date
对象集。如果给定的毫秒值包含时间信息,司机将设置时间组件在默认时区的时间(在java虚拟机中运行应用程序的时区),相当于零时间。
public static Date valueOf(String s)
Date
价值。
s
-
String
对象代表一个日期的格式为“年- [ M ] M [D] D”。领先的零
mm
和
dd
也可以省略。
java.sql.Date
对象
IllegalArgumentException
如果给定的日期不在JDBC的日期格式(YYYY -逃避[ M ] M [D] D)
public String toString()
toString
方法重写,继承类
Date
Date.toLocaleString()
,
Date.toGMTString()
@Deprecated public int getHours()
getHours
方法重写,继承类
Date
IllegalArgumentException
setHours(int)
@Deprecated public int getMinutes()
getMinutes
方法重写,继承类
Date
IllegalArgumentException
setMinutes(int)
@Deprecated public int getSeconds()
getSeconds
方法重写,继承类
Date
IllegalArgumentException
setSeconds(int)
@Deprecated public void setHours(int i)
setHours
方法重写,继承类
Date
i
-小时值。
IllegalArgumentException
getHours()
@Deprecated public void setMinutes(int i)
setMinutes
方法重写,继承类
Date
i
的分钟值。
IllegalArgumentException
getMinutes()
@Deprecated public void setSeconds(int i)
setSeconds
方法重写,继承类
Date
i
-秒的价值。
IllegalArgumentException
getSeconds()
public static Date valueOf(LocalDate date)
date
-
LocalDate
转换
Date
对象
NullPointerException
-如果
date
是空的
public LocalDate toLocalDate()
LocalDate
转换创建一个LocalDate
相同的日期值,这Date
本地时区
Date
对象
LocalDate
对象
public Instant toInstant()
Date
值没有时间成分。
toInstant
方法重写,继承类
Date
Date
对象
UnsupportedOperationException
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.