calendar.html

来自「维信SDK文档。源码要求为至少5个C或Java源码」· HTML 代码 · 共 658 行 · 第 1/2 页

HTML
658
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_11) on Tue Oct 23 19:38:41 EEST 2007 --><TITLE>Calendar (Widsets API)</TITLE><META NAME="keywords" CONTENT="Calendar class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="Calendar (Widsets API)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../widsets/api/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../widsets/api/ByteArray.html" title="class in "><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../widsets/api/Camera.html" title="class in "><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html?widsets/api/Calendar.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Calendar.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1"></FONT><BR>Class Calendar</H2><PRE>  <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../widsets/api/Object.html" title="class in ">Object</A>      <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>Calendar</B></PRE><HR><DL><DT><PRE>       class <B>Calendar</B><DT>extends <A HREF="../../widsets/api/Object.html" title="class in ">Object</A></DL></PRE><P><p> <code>Calendar</code> is a class for getting and setting dates using a set of integer fields such as <code>YEAR</code>, <code>MONTH</code>, <code>DAY</code>. </p>  <p> The fields are accessed directly in the code without a prefix: <pre>   Calendar cal = new Calendar();   // using the operator get [] and a constant field name   int today = cal[DAY_OF_WEEK];  </pre> </p> <p> Calendar data can be accessed using the in-built operators  <code>get</code> and <code>set</code> with brackets. </p>  <p> The following constant fields from <A HREF="../../widsets/api/API.html" title="class in "><CODE>API</CODE></A> are used with Calendar: <ul>   <li><A HREF="../../widsets/api/API.html#YEAR"><CODE>YEAR</CODE></A>   <li><A HREF="../../widsets/api/API.html#MONTH"><CODE>MONTH</CODE></A>   <li><A HREF="../../widsets/api/API.html#DATE"><CODE>DATE</CODE></A>   <li><A HREF="../../widsets/api/API.html#DAY_OF_MONTH"><CODE>DAY_OF_MONTH</CODE></A>   <li><A HREF="../../widsets/api/API.html#DAY_OF_WEEK"><CODE>DAY_OF_WEEK</CODE></A>   <li><A HREF="../../widsets/api/API.html#HOUR"><CODE>HOUR</CODE></A>   <li><A HREF="../../widsets/api/API.html#HOUR_OF_DAY"><CODE>HOUR_OF_DAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#MINUTE"><CODE>MINUTE</CODE></A>   <li><A HREF="../../widsets/api/API.html#SECOND"><CODE>SECOND</CODE></A>   <li><A HREF="../../widsets/api/API.html#MILLISECOND"><CODE>MILLISECOND</CODE></A>   <li><A HREF="../../widsets/api/API.html#AM_PM"><CODE>AM_PM</CODE></A>   <li><A HREF="../../widsets/api/API.html#AM"><CODE>AM</CODE></A>   <li><A HREF="../../widsets/api/API.html#PM"><CODE>PM</CODE></A> </ul> <ul>   <li><A HREF="../../widsets/api/API.html#SUNDAY"><CODE>SUNDAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#MONDAY"><CODE>MONDAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#TUESDAY"><CODE>TUESDAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#WEDNESDAY"><CODE>WEDNESDAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#THURSDAY"><CODE>THURSDAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#FRIDAY"><CODE>FRIDAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#SATURDAY"><CODE>SATURDAY</CODE></A> </ul> <ul>   <li><A HREF="../../widsets/api/API.html#JANUARY"><CODE>JANUARY</CODE></A>   <li><A HREF="../../widsets/api/API.html#FEBRUARY"><CODE>FEBRUARY</CODE></A>   <li><A HREF="../../widsets/api/API.html#MARCH"><CODE>MARCH</CODE></A>   <li><A HREF="../../widsets/api/API.html#APRIL"><CODE>APRIL</CODE></A>   <li><A HREF="../../widsets/api/API.html#MAY"><CODE>MAY</CODE></A>   <li><A HREF="../../widsets/api/API.html#JUNE"><CODE>JUNE</CODE></A>   <li><A HREF="../../widsets/api/API.html#JULY"><CODE>JULY</CODE></A>   <li><A HREF="../../widsets/api/API.html#AUGUST"><CODE>AUGUST</CODE></A>   <li><A HREF="../../widsets/api/API.html#SEPTEMBER"><CODE>SEPTEMBER</CODE></A>   <li><A HREF="../../widsets/api/API.html#OCTOBER"><CODE>OCTOBER</CODE></A>   <li><A HREF="../../widsets/api/API.html#NOVEMBER"><CODE>NOVEMBER</CODE></A>   <li><A HREF="../../widsets/api/API.html#DECEMBER"><CODE>DECEMBER</CODE></A> </ul> </p> <p> The following constant fields from <A HREF="../../widsets/api/API.html" title="class in "><CODE>API</CODE></A> are used with Calendar for formatting: <ul>   <li><A HREF="../../widsets/api/API.html#FORMAT_DATE"><CODE>FORMAT_DATE</CODE></A>   <li><A HREF="../../widsets/api/API.html#FORMAT_TIME"><CODE>FORMAT_TIME</CODE></A>   <li><A HREF="../../widsets/api/API.html#FORMAT_DATETIME"><CODE>FORMAT_DATETIME</CODE></A> </ul> </p><P><P><DL><DT><B>See Also:</B><DD><a href="package-summary.html#operators">Operators</a>, <a href="package-summary.html#operator_get">operator get</a>, <a href="package-summary.html#operator_set">operator set</a></DL><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#Calendar()">Calendar</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a calendar using the default time zone and locale.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#Calendar(TimeZone)">Calendar</A></B>(<A HREF="../../widsets/api/TimeZone.html" title="class in ">TimeZone</A>&nbsp;timeZone)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a calendar using the time zone given as argument and default locale.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#after(Calendar)">after</A></B>(<A HREF="../../widsets/api/Calendar.html" title="class in ">Calendar</A>&nbsp;when)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares the time field records.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#before(Calendar)">before</A></B>(<A HREF="../../widsets/api/Calendar.html" title="class in ">Calendar</A>&nbsp;when)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares the time field records.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Calendar.html" title="class in ">Calendar</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#copy()">copy</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a copy from this calendar instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/String.html" title="class in ">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#format(int)">format</A></B>(int&nbsp;format)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formats calendars date and/or time as string according to current locale/language.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;long</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#getMillis()">getMillis</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets this Calendar's current time as a long expressed in milliseconds after January 1, 1970, 0:00:00 GMT (the epoch).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/TimeZone.html" title="class in ">TimeZone</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#getTimeZone()">getTimeZone</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>TimeZone</code> for this <code>Calendar</code> object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#operator_get(int)">operator_get</A></B>(int&nbsp;field)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the value for a given time field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#operator_set(int, int)">operator_set</A></B>(int&nbsp;field,             int&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the time field with the given value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#set(int, int, int)">set</A></B>(int&nbsp;year,    int&nbsp;month,    int&nbsp;date)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the values for the fields year, month, and date.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#set(int, int, int, int, int)">set</A></B>(int&nbsp;year,    int&nbsp;month,    int&nbsp;date,    int&nbsp;hour,    int&nbsp;minute)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the values for the fields year, month, date, hour, and minute.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#set(int, int, int, int, int, int)">set</A></B>(int&nbsp;year,    int&nbsp;month,    int&nbsp;date,    int&nbsp;hour,    int&nbsp;minute,    int&nbsp;second)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the values for the fields year, month, date, hour, minute, and second.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#setMillis(long)">setMillis</A></B>(long&nbsp;millis)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets this Calendar's current time from the given long value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Calendar.html#setTimeZone(TimeZone)">setTimeZone</A></B>(<A HREF="../../widsets/api/TimeZone.html" title="class in ">TimeZone</A>&nbsp;timeZone)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the <code>TimeZone</code> for this <code>Calendar</code> object.</TD></TR>

⌨️ 快捷键说明

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