⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 date.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<A NAME="Date(int, int, int, int, int)"><!-- --></A><H3>Date</H3><PRE>public <B>Date</B>(int&nbsp;year,            int&nbsp;month,            int&nbsp;date,            int&nbsp;hrs,            int&nbsp;min)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>Calendar.set(year + 1900, month, date, hrs, min)</code> or <code>GregorianCalendar(year + 1900, month, date, hrs, min)</code>.</I><P><DD>Allocates a <code>Date</code> object and initializes it so that  it represents the instant at the start of the minute specified by  the <code>year</code>, <code>month</code>, <code>date</code>,  <code>hrs</code>, and <code>min</code> arguments, in the local  time zone.<DD><DL><DT><B>Parameters:</B><DD><CODE>year</CODE> - the year minus 1900.<DD><CODE>month</CODE> - the month between 0-11.<DD><CODE>date</CODE> - the day of the month between 1-31.<DD><CODE>hrs</CODE> - the hours between 0-23.<DD><CODE>min</CODE> - the minutes between 0-59.<DT><B>See Also: </B><DD><A HREF="../../java/util/Calendar.html"><CODE>Calendar</CODE></A></DL></DD></DL><HR><A NAME="Date(int, int, int, int, int, int)"><!-- --></A><H3>Date</H3><PRE>public <B>Date</B>(int&nbsp;year,            int&nbsp;month,            int&nbsp;date,            int&nbsp;hrs,            int&nbsp;min,            int&nbsp;sec)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>Calendar.set(year + 1900, month, date, hrs, min, sec)</code> or <code>GregorianCalendar(year + 1900, month, date, hrs, min, sec)</code>.</I><P><DD>Allocates a <code>Date</code> object and initializes it so that  it represents the instant at the start of the second specified  by the <code>year</code>, <code>month</code>, <code>date</code>,  <code>hrs</code>, <code>min</code>, and <code>sec</code> arguments,  in the local time zone.<DD><DL><DT><B>Parameters:</B><DD><CODE>year</CODE> - the year minus 1900.<DD><CODE>month</CODE> - the month between 0-11.<DD><CODE>date</CODE> - the day of the month between 1-31.<DD><CODE>hrs</CODE> - the hours between 0-23.<DD><CODE>min</CODE> - the minutes between 0-59.<DD><CODE>sec</CODE> - the seconds between 0-59.<DT><B>See Also: </B><DD><A HREF="../../java/util/Calendar.html"><CODE>Calendar</CODE></A></DL></DD></DL><HR><A NAME="Date(java.lang.String)"><!-- --></A><H3>Date</H3><PRE>public <B>Date</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;s)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>DateFormat.parse(String s)</code>.</I><P><DD>Allocates a <code>Date</code> object and initializes it so that  it represents the date and time indicated by the string  <code>s</code>, which is interpreted as if by the  <A HREF="../../java/util/Date.html#parse(java.lang.String)"><CODE>parse(java.lang.String)</CODE></A> method.<DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - a string representation of the date.<DT><B>See Also: </B><DD><A HREF="../../java/text/DateFormat.html"><CODE>DateFormat</CODE></A>, <A HREF="../../java/util/Date.html#parse(java.lang.String)"><CODE>parse(java.lang.String)</CODE></A></DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="clone()"><!-- --></A><H3>clone</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>clone</B>()</PRE><DL><DD>Return a copy of this object.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD>Following copied from class: <CODE>java.lang.Object</CODE></DD><DD><DL><DT><B>Returns:</B><DD>a clone of this instance.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/CloneNotSupportedException.html">CloneNotSupportedException</A></CODE> - if the object's class does not               support the <code>Cloneable</code> interface. Subclasses               that override the <code>clone</code> method can also               throw this exception to indicate that an instance cannot               be cloned.<DD><CODE><A HREF="../../java/lang/OutOfMemoryError.html">OutOfMemoryError</A></CODE> - if there is not enough memory.<DT><B>See Also: </B><DD><A HREF="../../java/lang/Cloneable.html"><CODE>Cloneable</CODE></A></DL></DD></DL><HR><A NAME="UTC(int, int, int, int, int, int)"><!-- --></A><H3>UTC</H3><PRE>public static long <B>UTC</B>(int&nbsp;year,                       int&nbsp;month,                       int&nbsp;date,                       int&nbsp;hrs,                       int&nbsp;min,                       int&nbsp;sec)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>Calendar.set(year + 1900, month, date, hrs, min, sec)</code> or <code>GregorianCalendar(year + 1900, month, date, hrs, min, sec)</code>, using a UTC <code>TimeZone</code>, followed by <code>Calendar.getTime().getTime()</code>.</I><P><DD>Determines the date and time based on the arguments. The  arguments are interpreted as a year, month, day of the month,  hour of the day, minute within the hour, and second within the  minute, exactly as for the <tt>Date</tt> constructor with six  arguments, except that the arguments are interpreted relative  to UTC rather than to the local time zone. The time indecated is  returned represented as the distance, measured in milliseconds,  of that time from the epoch (00:00:00 GMT on January 1, 1970).<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>year</CODE> - the year minus 1900.<DD><CODE>month</CODE> - the month between 0-11.<DD><CODE>date</CODE> - the day of the month between 1-31.<DD><CODE>hrs</CODE> - the hours between 0-23.<DD><CODE>min</CODE> - the minutes between 0-59.<DD><CODE>sec</CODE> - the seconds between 0-59.<DT><B>Returns:</B><DD>the number of milliseconds since January 1, 1970, 00:00:00 GMT for          the date and time specified by the arguments.<DT><B>See Also: </B><DD><A HREF="../../java/util/Calendar.html"><CODE>Calendar</CODE></A></DL></DD></DL><HR><A NAME="parse(java.lang.String)"><!-- --></A><H3>parse</H3><PRE>public static long <B>parse</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;s)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>DateFormat.parse(String s)</code>.</I><P><DD>Attempts to interpret the string <tt>s</tt> as a representation  of a date and time. If the attempt is successful, the time  indicated is returned represented as the distance, measured in  milliseconds, of that time from the epoch (00:00:00 GMT on  January 1, 1970). If the attempt fails, an  <tt>IllegalArgumentException</tt> is thrown. <p> It accepts many syntaxes; in particular, it recognizes the IETF  standard date syntax: "Sat, 12 Aug 1995 13:30:00 GMT". It also  understands the continental U.S. time-zone abbreviations, but for  general use, a time-zone offset should be used: "Sat, 12 Aug 1995  13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich  meridian). If no time zone is specified, the local time zone is  assumed. GMT and UTC are considered equivalent. <p> The string <tt>s</tt> is processed from left to right, looking for  data of interest. Any material in <tt>s</tt> that is within the  ASCII parenthesis characters <tt>(</tt> and <tt>)</tt> is ignored.  Parentheses may be nested. Otherwise, the only characters permitted  within <tt>s</tt> are these ASCII characters: <blockquote><pre> abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789,+-:/</pre></blockquote> and whitespace characters.<p> A consecutive sequence of decimal digits is treated as a decimal  number:<ul> <li>If a number is preceded by <tt>+</tt> or <tt>-</tt> and a year      has already been recognized, then the number is a time-zone      offset. If the number is less than 24, it is an offset measured      in hours. Otherwise, it is regarded as an offset in minutes,      expressed in 24-hour time format without punctuation. A      preceding <tt>-</tt> means a westward offset. Time zone offsets      are always relative to UTC (Greenwich). Thus, for example,      <tt>-5</tt> occurring in the string would mean "five hours west      of Greenwich" and <tt>+0430</tt> would mean "four hours and      thirty minutes east of Greenwich." It is permitted for the      string to specify <tt>GMT</tt>, <tt>UT</tt>, or <tt>UTC</tt>      redundantly-for example, <tt>GMT-5</tt> or <tt>utc+0430</tt>. <li>The number is regarded as a year number if one of the     following conditions is true: <ul>     <li>The number is equal to or greater than 70 and followed by a         space, comma, slash, or end of string     <li>The number is less than 70, and both a month and a day of         the month have already been recognized</li> </ul>     If the recognized year number is less than 100, it is     interpreted as an abbreviated year relative to a century of     which dates are within 80 years before and 19 years after     the time when the Date class is initialized.     After adjusting the year number, 1900 is subtracted from     it. For example, if the current year is 1999 then years in     the range 19 to 99 are assumed to mean 1919 to 1999, while     years from 0 to 18 are assumed to mean 2000 to 2018.  Note     that this is slightly different from the interpretation of     years less than 100 that is used in <A HREF="../../java/text/SimpleDateFormat.html"><CODE>SimpleDateFormat</CODE></A>. <li>If the number is followed by a colon, it is regarded as an hour,      unless an hour has already been recognized, in which case it is      regarded as a minute. <li>If the number is followed by a slash, it is regarded as a month      (it is decreased by 1 to produce a number in the range <tt>0</tt>      to <tt>11</tt>), unless a month has already been recognized, in      which case it is regarded as a day of the month. <li>If the number is followed by whitespace, a comma, a hyphen, or      end of string, then if an hour has been recognized but not a      minute, it is regarded as a minute; otherwise, if a minute has      been recognized but not a second, it is regarded as a second;      otherwise, it is regarded as a day of the month. </ul><p> A consecutive sequence of letters is regarded as a word and treated  as follows:<ul> <li>A word that matches <tt>AM</tt>, ignoring case, is ignored (but      the parse fails if an hour has not been recognized or is less      than <tt>1</tt> or greater than <tt>12</tt>). <li>A word that matches <tt>PM</tt>, ignoring case, adds <tt>12</tt>      to the hour (but the parse fails if an hour has not been      recognized or is less than <tt>1</tt> or greater than <tt>12</tt>). <li>Any word that matches any prefix of <tt>SUNDAY, MONDAY, TUESDAY,      WEDNESDAY, THURSDAY, FRIDAY</tt>, or <tt>SATURDAY</tt>, ignoring      case, is ignored. For example, <tt>sat, Friday, TUE</tt>, and      <tt>Thurs</tt> are ignored. <li>Otherwise, any word that matches any prefix of <tt>JANUARY,      FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER,      OCTOBER, NOVEMBER</tt>, or <tt>DECEMBER</tt>, ignoring case, and      considering them in the order given here, is recognized as     specifying a month and is converted to a number (<tt>0</tt> to      <tt>11</tt>). For example, <tt>aug, Sept, april</tt>, and      <tt>NOV</tt> are recognized as months. So is <tt>Ma</tt>, which      is recognized as <tt>MARCH</tt>, not <tt>MAY</tt>. <li>Any word that matches <tt>GMT, UT</tt>, or <tt>UTC</tt>, ignoring      case, is treated as referring to UTC.  <li>Any word that matches <tt>EST, CST, MST</tt>, or <tt>PST</tt>,      ignoring case, is recognized as referring to the time zone in      North America that is five, six, seven, or eight hours west of      Greenwich, respectively. Any word that matches <tt>EDT, CDT,      MDT</tt>, or <tt>PDT</tt>, ignoring case, is recognized as      referring to the same time zone, respectively, during daylight      saving time.</ul><p> Once the entire string s has been scanned, it is converted to a time  result in one of two ways. If a time zone or time-zone offset has been  recognized, then the year, month, day of month, hour, minute, and  second are interpreted in UTC and then the time-zone offset is  applied. Otherwise, the year, month, day of month, hour, minute, and  second are interpreted in the local time zone.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - a string to be parsed as a date.<DT><B>Returns:</B><DD>the number of milliseconds since January 1, 1970, 00:00:00 GMT          represented by the string argument.<DT><B>See Also: </B><DD><A HREF="../../java/text/DateFormat.html"><CODE>DateFormat</CODE></A></DL></DD></DL><HR><A NAME="getYear()"><!-- --></A><H3>getYear</H3><PRE>public int <B>getYear</B>()</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>Calendar.get(Calendar.YEAR) - 1900</code>.</I><P><DD>Returns a value that 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.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the year represented by this date, minus 1900.<DT><B>See Also: </B><DD><A HREF="../../java/util/Calendar.html"><CODE>Calendar</CODE></A></DL></DD></DL><HR><A NAME="setYear(int)"><!-- --></A><H3>setYear</H3><PRE>public void <B>setYear</B>(int&nbsp;year)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<I>As of JDK version 1.1, replaced by <code>Calendar.set(Calendar.YEAR, year + 1900)</code>.</I><P><DD>Sets the year of this <tt>Date</tt> object to be the specified  value plus 1900. 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.)<DD><DL></DL></DD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -