📄 javautil.doc2.html
字号:
<li><code>mon</code> is the month (<code>Jan</code>, <code>Feb</code>, <code>Mar</code>, <code>Apr</code>, <code>May</code>, <code>Jun</code>, <code>Jul</code>, <code>Aug</code>, <code>Sep</code>, <code>Oct</code>, <code>Nov</code>, <code>Dec</code>).
<a name="20472"></a>
<li><code>dd</code> is the day of the month (<code>01</code> through <code>31</code>), as two decimal digits.
<a name="20514"></a>
<li><code>hh</code> is the hour of the day (<code>00</code> through <code>23</code>), as two decimal digits.
<a name="20518"></a>
<li><code>mm</code> is the minute within the hour (<code>00</code> through <code>59</code>), as two decimal digits.
<a name="20522"></a>
<li><code>ss</code> is the second within the minute (<code>00</code> through <code>61</code>), as two decimal digits.
<a name="20545"></a>
<li><code>zzz</code> is the time zone (and may reflect daylight saving time). Standard time zone abbreviations include those recognized by the method <code>parse</code> <a href="javautil.doc2.html#21075">(§21.3.31)</a>. If time zone information is not available, then <code>zzz</code> is empty-that is, it consists of no characters at all.
<a name="20546"></a>
<li><code>yyyy</code> is the year, as four decimal digits.
</ul><a name="20397"></a>
See also methods <code>toLocaleString</code> <a href="javautil.doc2.html#7495">(§21.3.27)</a> and <code>toGMTString</code> <a href="javautil.doc2.html#7496">(§21.3.28)</a>.<p>
<a name="8949"></a>
Overrides the <code>toString</code> method of <code>Object</code> <a href="javalang.doc1.html#1152">(§20.1.2)</a>.<p>
<a name="8903"></a>
<p><font size=+1><strong>21.3.8 </strong> <code>public boolean <code><b>equals</b></code>(Object obj)</code></font>
<p>
<a name="8977"></a>
The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>Date</code> object that
represents the same point in time, to the millisecond, as this <code>Date</code> object. Thus
two <code>Date</code> objects are equal if and only if the <code>getTime</code> method <a href="javautil.doc2.html#7488">(§21.3.23)</a> returns
the same <code>long</code> value from both.
<p><a name="8958"></a>
Overrides the <code>equals</code> method of <code>Object</code> <a href="javalang.doc1.html#14865">(§20.1.3)</a>.<p>
<a name="8576"></a>
<p><font size=+1><strong>21.3.9 </strong> <code>public int <code><b>hashCode</b></code>()</code></font>
<p>
<a name="8991"></a>
The result is the exclusive OR of the two halves of the primitive <code>long</code> value
returned by the <code>getTime</code> method <a href="javautil.doc2.html#7488">(§21.3.23)</a>. That is, the hash code is the value of
the expression:
<p><pre><a name="8992"></a>(int)(this.getTime()^(this.getTime()>>>32))
</pre><a name="8965"></a>
Overrides the <code>hashCode</code> method of <code>Object</code> <a href="javalang.doc1.html#13784">(§20.1.4)</a>.<p>
<a name="7475"></a>
<p><font size=+1><strong>21.3.10 </strong> <code>public int <code><b>getYear</b></code>()</code></font>
<p>
<a name="9008"></a>
The returned value is the result of subtracting 1900 from the year that contains or
begins with the instant in time represented by this <code>Date</code> object, as interpreted in
the local time zone.
<p><a name="7476"></a>
<p><font size=+1><strong>21.3.11 </strong> <code>public void <code><b>setYear</b></code>(int year)</code></font>
<p>
<a name="9009"></a>
This <code>Date</code> object is modified so that it represents a point in time within the specified
year, with the month, date, hour, minute, and second the same as before, as
interpreted in the local time zone. (Of course, if the date was February 29, for
example, and the year is set to a non-leap year, then the new date will be treated
as if it were on March 1.)
<p><a name="7477"></a>
<p><font size=+1><strong>21.3.12 </strong> <code>public int <code><b>getMonth</b></code>()</code></font>
<p>
<a name="20577"></a>
The returned value is a number (<code>0</code> through <code>11</code>) representing the month that contains
or begins with the instant in time represented by this <code>Date</code> object, as interpreted
in the local time zone.
<p><a name="7478"></a>
<p><font size=+1><strong>21.3.13 </strong> <code>public void <code><b>setMonth</b></code>(int month)</code></font>
<p>
<a name="20675"></a>
This <code>Date</code> object is modified so that it represents a point in time within the specified
month, with the year, date, hour, minute, and second the same as before, as
interpreted in the local time zone. If the date was October 31, for example, and the
month is set to June, then the new date will be treated as if it were on July 1,
because June has only 30 days.
<p><a name="7479"></a>
<p><font size=+1><strong>21.3.14 </strong> <code>public int <code><b>getDate</b></code>()</code></font>
<p>
<a name="20584"></a>
The returned value is a number (<code>1</code> through <code>31</code>) representing day of the month that
contains or begins with the instant in time represented by this <code>Date</code> object, as
interpreted in the local time zone.
<p><a name="20697"></a>
<p><font size=+1><strong>21.3.15 </strong> <code>public void <code><b>setDate</b></code>(int date)</code></font>
<p>
<a name="20710"></a>
This <code>Date</code> object is modified so that it represents a point in time within the specified
day of the month, with the year, month, hour, minute, and second the same as
before, as interpreted in the local time zone.If the date was April 30, for example,
and the date is set to 31, then it will be treated as if it were on May 1, because
April has only 30 days.
<p><a name="20698"></a>
<p><font size=+1><strong>21.3.16 </strong> <code>public int <code><b>getDay</b></code>()</code></font>
<p>
<a name="20699"></a>
The returned value (<code>0</code> = Sunday, <code>1</code> = Monday, <code>2</code> = Tuesday, <code>3</code> = Wednesday, <code>4</code> =
Thursday, <code>5</code> = Friday, <code>6</code> = Saturday) represents the day of the week that contains or
begins with the instant in time represented by this <code>Date</code> object, as interpreted in
the local time zone.
<p><a name="7482"></a>
<p><font size=+1><strong>21.3.17 </strong> <code>public int <code><b>getHours</b></code>()</code></font>
<p>
<a name="20592"></a>
The returned value is a number (<code>0</code> through <code>23</code>) representing the hour within the
day that contains or begins with the instant in time represented by this <code>Date</code>
object, as interpreted in the local time zone.
<p><a name="20739"></a>
<p><font size=+1><strong>21.3.18 </strong> <code>public void <code><b>setHours</b></code>(int hours)</code></font>
<p>
<a name="20744"></a>
This <code>Date</code> object is modified so that it represents a point in time within the specified
hour of the day, with the year, month, date, minute, and second the same as
before, as interpreted in the local time zone.
<p><a name="20740"></a>
<p><font size=+1><strong>21.3.19 </strong> <code>public int <code><b>getMinutes</b></code>()</code></font>
<p>
<a name="20741"></a>
The returned value is a number (<code>0</code> through <code>59</code>) representing the minute within the
hour that contains or begins with the instant in time represented by this <code>Date</code>
object, as interpreted in the local time zone.
<p><a name="7485"></a>
<p><font size=+1><strong>21.3.20 </strong> <code>public void <code><b>setMinutes</b></code>(int minutes)</code></font>
<p>
<a name="20754"></a>
This <code>Date</code> object is modified so that it represents a point in time within the specified
minute of the hour, with the year, month, date, hour, and second the same as
before, as interpreted in the local time zone.
<p><a name="7486"></a>
<p><font size=+1><strong>21.3.21 </strong> <code>public int <code><b>getSeconds</b></code>()</code></font>
<p>
<a name="20600"></a>
The returned value is a number (<code>0</code> through <code>61</code>) representing the second within the
minute that contains or begins with the instant in time represented by this <code>Date</code>
object, as interpreted in the local time zone.
<p><a name="7487"></a>
<p><font size=+1><strong>21.3.22 </strong> <code>public void <code><b>setSeconds</b></code>(int seconds)</code></font>
<p>
<a name="20762"></a>
This <code>Date</code> object is modified so that it represents a point in time within the specified
second of the minute, with the year, month, date, hour, and minute the same
as before, as interpreted in the local time zone.
<p><a name="7488"></a>
<p><font size=+1><strong>21.3.23 </strong> <code>public long <code><b>getTime</b></code>()</code></font>
<p>
<a name="20780"></a>
This method returns the time represented by this <code>Date</code> object, represented as the
distance, measured in milliseconds, of that time from the epoch (00:00:00 GMT
on January 1, 1970).
<p><a name="7489"></a>
<p><font size=+1><strong>21.3.24 </strong> <code>public void <code><b>setTime</b></code>(long time)</code></font>
<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -