date.html
来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 1,226 行 · 第 1/5 页
HTML
1,226 行
<BR> 比较两个日期的相等性。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getDate()">getDate</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.DAY_OF_MONTH)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getDay()">getDay</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.DAY_OF_WEEK)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getHours()">getHours</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.HOUR_OF_DAY)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getMinutes()">getMinutes</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.MINUTE)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getMonth()">getMonth</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.MONTH)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getSeconds()">getSeconds</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.SECOND)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getTime()">getTime</A></B>()</CODE><BR> 返回自 1970 年 1 月 1 日 00:00:00 GMT 以来此 <tt>Date</tt> 对象表示的毫秒数。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getTimezoneOffset()">getTimezoneOffset</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>-(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / (60 * 1000)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#getYear()">getYear</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.get(Calendar.YEAR) - 1900</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#hashCode()">hashCode</A></B>()</CODE><BR> 返回此对象的哈希代码值。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#parse(java.lang.String)">parse</A></B>(<A HREF="../lang/String.html" title="java.lang 中的类">String</A> s)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>DateFormat.parse(String s)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setDate(int)">setDate</A></B>(int date)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(Calendar.DAY_OF_MONTH, int date)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setHours(int)">setHours</A></B>(int hours)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(Calendar.HOUR_OF_DAY, int hours)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setMinutes(int)">setMinutes</A></B>(int minutes)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(Calendar.MINUTE, int minutes)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setMonth(int)">setMonth</A></B>(int month)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(Calendar.MONTH, int month)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setSeconds(int)">setSeconds</A></B>(int seconds)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(Calendar.SECOND, int seconds)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setTime(long)">setTime</A></B>(long time)</CODE><BR> 设置此 <code>Date</code> 对象,以表示 1970 年 1 月 1 日 00:00:00 GMT 以后 <code>time</code> 毫秒的时间点。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#setYear(int)">setYear</A></B>(int year)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(Calendar.YEAR, year + 1900)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../lang/String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#toGMTString()">toGMTString</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>DateFormat.format(Date date)</code> 取代,使用 GMT <code>TimeZone</code>。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../lang/String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#toLocaleString()">toLocaleString</A></B>()</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>DateFormat.format(Date date)</code> 取代。</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../lang/String.html" title="java.lang 中的类">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#toString()">toString</A></B>()</CODE><BR> 把此 <code>Date</code> 对象转换为以下形式的 <code>String</code>: dow mon dd hh:mm:ss zzz yyyy其中:<tt>dow</tt> 是一周中的某一天 (<tt>Sun, Mon, Tue, Wed, Thu, Fri, Sat</tt>)。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static long</CODE></FONT></TD><TD><CODE><B><A HREF="Date.html#UTC(int, int, int, int, int, int)">UTC</A></B>(int year, int month, int date, int hrs, int min, int sec)</CODE><BR> <B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(year + 1900, month, date, hrs, min, sec)</code> 或 <code>GregorianCalendar(year + 1900, month, date, hrs, min, sec)</code> 取代,使用 UTC <code>TimeZone</code>,后跟 <code>Calendar.getTime().getTime()</code>。</I></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.lang.<A HREF="../lang/Object.html" title="java.lang 中的类">Object</A> 继承的方法</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../lang/Object.html#finalize()">finalize</A>, <A HREF="../lang/Object.html#getClass()">getClass</A>, <A HREF="../lang/Object.html#notify()">notify</A>, <A HREF="../lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../lang/Object.html#wait()">wait</A>, <A HREF="../lang/Object.html#wait(long)">wait</A>, <A HREF="../lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>构造方法详细信息</B></FONT></TH></TR></TABLE><A NAME="Date()"><!-- --></A><H3>Date</H3><PRE>public <B>Date</B>()</PRE><DL><DD>分配 <code>Date</code> 对象并初始化此对象,以表示分配它的时间(精确到毫秒)。<P><DL><DT><B>另请参见:</B><DD><A HREF="../lang/System.html#currentTimeMillis()"><CODE>System.currentTimeMillis()</CODE></A></DL></DL><HR><A NAME="Date(long)"><!-- --></A><H3>Date</H3><PRE>public <B>Date</B>(long date)</PRE><DL><DD>分配 <code>Date</code> 对象并初始化此对象,以表示自从标准基准时间(称为“历元(epoch)”,即 1970 年 1 月 1 日 00:00:00 GMT)以来的指定毫秒数。<P><DL><DT><B>参数:</B><DD><CODE>date</CODE> - 自 1970 年 1 月 1 日 00:00:00 GMT 以来的毫秒数。<DT><B>另请参见:</B><DD><A HREF="../lang/System.html#currentTimeMillis()"><CODE>System.currentTimeMillis()</CODE></A></DL></DL><HR><A NAME="Date(int, int, int)"><!-- --></A><H3>Date</H3><PRE><FONT SIZE="-1"><A HREF="../lang/Deprecated.html" title="java.lang 中的注释">@Deprecated</A></FONT>public <B>Date</B>(int year, int month, int date)</PRE><DL><DD><B>已过时。</B> <I>从 JDK 1.1 开始,由 <code>Calendar.set(year + 1900, month, date)</code> 或 <code>GregorianCalendar(year + 1900, month, date)</code> 取代。</I><P>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?