📄 dateutil.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Wed Jan 15 11:28:21 CET 2003 --><TITLE>DateUtil</TITLE><META NAME="keywords" CONTENT="javatools.util.DateUtil,DateUtil class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><SCRIPT>function asd(){parent.document.title="DateUtil";}</SCRIPT><BODY BGCOLOR="white" onload="asd();"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javatools/util/Compare.html"><B>PREV CLASS</B></A> <A HREF="../../javatools/util/FileLog.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="DateUtil.html" TARGET="_top"><B>NO FRAMES</B></A> <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javatools.util</FONT><BR>Class DateUtil</H2><PRE>java.lang.Object | +--<B>javatools.util.DateUtil</B></PRE><HR><DL><DT>public class <B>DateUtil</B><DT>extends java.lang.Object</DL><P>A utility class for use with dates.<P><P><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#DateUtil()">DateUtil</A></B>()</CODE><BR> </TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#daysInMonth(int, int)">daysInMonth</A></B>(int month, int year)</CODE><BR> Returns the number of days in a month depending on the year. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#leapYear(int)">leapYear</A></B>(int year)</CODE><BR> Checks if a year is a leap year.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#maxMonthSize(int)">maxMonthSize</A></B>(int month)</CODE><BR> Returns the maximum value of days in a month.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.sql.Date</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#minusInfinity()">minusInfinity</A></B>()</CODE><BR> Return a date represting a long time in the past.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#monthSize(int)">monthSize</A></B>(int month)</CODE><BR> Returns the month size.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.sql.Date</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#plusInfinity()">plusInfinity</A></B>()</CODE><BR> Return a date representing a long time in the future. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.sql.Timestamp</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#timestampNow()">timestampNow</A></B>()</CODE><BR> Return a Timestamp object representing the time now.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../javatools/util/DateUtil.html#validDate(int, int, int)">validDate</A></B>(int date, int month, int year)</CODE><BR> Checks if a date is vald. </TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="DateUtil()"><!-- --></A><H3>DateUtil</H3><PRE>public <B>DateUtil</B>()</PRE><DL></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="minusInfinity()"><!-- --></A><H3>minusInfinity</H3><PRE>public static java.sql.Date <B>minusInfinity</B>()</PRE><DL><DD>Return a date represting a long time in the past.<P><DD><DL><DT><B>Returns:</B><DD>-infinity date.</DL></DD></DL><HR><A NAME="plusInfinity()"><!-- --></A><H3>plusInfinity</H3><PRE>public static java.sql.Date <B>plusInfinity</B>()</PRE><DL><DD>Return a date representing a long time in the future. Sometimes people who don't like to use NULL values in databases use this as a kind of NULL value. Alternatively it can be sometimes useful in a SELECT to force use of an index.<P><DD><DL><DT><B>Returns:</B><DD>+infinity date.</DL></DD></DL><HR><A NAME="timestampNow()"><!-- --></A><H3>timestampNow</H3><PRE>public static java.sql.Timestamp <B>timestampNow</B>()</PRE><DL><DD>Return a Timestamp object representing the time now.<P><DD><DL><DT><B>Returns:</B><DD>Excuse me what time is it?</DL></DD></DL><HR><A NAME="leapYear(int)"><!-- --></A><H3>leapYear</H3><PRE>public static boolean <B>leapYear</B>(int year)</PRE><DL><DD>Checks if a year is a leap year.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>year</CODE> - The year to check.<DT><B>Returns:</B><DD><CODE>true</CODE>: the year is a leap year; <CODE>false</CODE>: the year is a normal year.</DL></DD></DL><HR><A NAME="monthSize(int)"><!-- --></A><H3>monthSize</H3><PRE>public static int <B>monthSize</B>(int month)</PRE><DL><DD>Returns the month size.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>month</CODE> - The month to check.<DT><B>Returns:</B><DD>The number of contained days.</DL></DD></DL><HR><A NAME="maxMonthSize(int)"><!-- --></A><H3>maxMonthSize</H3><PRE>public static int <B>maxMonthSize</B>(int month)</PRE><DL><DD>Returns the maximum value of days in a month.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>month</CODE> - The month to check.<DT><B>Returns:</B><DD>The maximum number of days contained in this month.</DL></DD></DL><HR><A NAME="daysInMonth(int, int)"><!-- --></A><H3>daysInMonth</H3><PRE>public static int <B>daysInMonth</B>(int month, int year)</PRE><DL><DD>Returns the number of days in a month depending on the year. Month is zero based.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>month</CODE> - The month to check.<DD><CODE>year</CODE> - The year to use.<DT><B>Returns:</B><DD>The number of days in the month at a certain year.</DL></DD></DL><HR><A NAME="validDate(int, int, int)"><!-- --></A><H3>validDate</H3><PRE>public static boolean <B>validDate</B>(int date, int month, int year)</PRE><DL><DD>Checks if a date is vald. month is zero based. date is not.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>date</CODE> - The day in the month.<DD><CODE>month</CODE> - The month.<DD><CODE>year</CODE> - The year.<DT><B>Returns:</B><DD><CODE>true</CODE>: the date is valid; <CODE>false</CODE>: the date is NOT valid.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javatools/util/Compare.html"><B>PREV CLASS</B></A> <A HREF="../../javatools/util/FileLog.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="DateUtil.html" TARGET="_top"><B>NO FRAMES</B></A> <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -