<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.text.SimpleDateFormat
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="java.text.RuleBasedCollator.html#_top_">Previous</a>  <a href="java.text.StringCharacterIterator.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.text.SimpleDateFormat
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.text.Format.html#_top_">java.text.Format</a>
           |
           +----<a href="java.text.DateFormat.html#_top_">java.text.DateFormat</a>
                   |
                   +----java.text.SimpleDateFormat
</pre>
<hr>
<dl>
  <dt> public class <b>SimpleDateFormat</b>
  <dt> extends <a href="java.text.DateFormat.html#_top_">DateFormat</a>
</dl>
<code>SimpleDateFormat</code> is a concrete class for formatting and
 parsing dates in a locale-sensitive manner. It allows for formatting
 (date -> text), parsing (text -> date), and normalization.
 <p>
 <code>SimpleDateFormat</code> allows you to start by choosing
 any user-defined patterns for date-time formatting. However, you
 are encouraged to create a date-time formatter with either
 <code>getTimeInstance</code>, <code>getDateInstance</code>, or
 <code>getDateTimeInstance</code> in <code>DateFormat</code>. Each
 of these class methods can return a date/time formatter initialized
 with a default format pattern. You may modify the format pattern
 using the <code>applyPattern</code> methods as desired.
 For more information on using these methods, see
 <a href="java.text.DateFormat.html"><code>DateFormat</code></a>.
 <p>
 <strong>Time Format Syntax:</strong>
 <p>
 To specify the time format use a <em>time pattern</em> string.
 In this pattern, all ASCII letters are reserved as pattern letters,
 which are defined as the following:
 <blockquote>
 <pre>
 Symbol   Meaning                 Presentation        Example
 ------   -------                 ------------        -------
 G        era designator          (Text)              AD
 y        year                    (Number)            1996
 M        month in year           (Text & Number)     July & 07
 d        day in month            (Number)            10
 h        hour in am/pm (1~12)    (Number)            12
 H        hour in day (0~23)      (Number)            0
 m        minute in hour          (Number)            30
 s        second in minute        (Number)            55
 S        millisecond             (Number)            978
 E        day in week             (Text)              Tuesday
 D        day in year             (Number)            189
 F        day of week in month    (Number)            2 (2nd Wed in July)
 w        week in year            (Number)            27
 W        week in month           (Number)            2
 a        am/pm marker            (Text)              PM
 k        hour in day (1~24)      (Number)            24
 K        hour in am/pm (0~11)    (Number)            0
 z        time zone               (Text)              Pacific Standard Time
 '        escape for text         (Delimiter)
 ''       single quote            (Literal)           '
 </pre>
 </blockquote>
 The count of pattern letters determine the format.
 <p>
 <strong>(Text)</strong>: 4 or more pattern letters--use full form,
 &lt 4--use short or abbreviated form if one exists.
 <p>
 <strong>(Number)</strong>: the minimum number of digits. Shorter
 numbers are zero-padded to this amount. Year is handled specially;
 that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.
 <p>
 <strong>(Text & Number)</strong>: 3 or over, use text, otherwise use number.
 <p>
 Any characters in the pattern that are not in the ranges of ['a'..'z']
 and ['A'..'Z'] will be treated as quoted text. For instance, characters
 like ':', '.', ' ', '#' and '@' will appear in the resulting time text
 even they are not embraced within single quotes.
 <p>
 A pattern containing any invalid pattern letter will result in a thrown
 exception during formatting or parsing.
 <p>
 <strong>Examples Using the US Locale:</strong>
 <blockquote>
 <pre>
 Format Pattern                         Result
 --------------                         -------
 "yyyy.MM.dd G 'at' hh:mm:ss z"    ->>  1996.07.10 AD at 15:08:56 PDT
 "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96
 "h:mm a"                          ->>  12:08 PM
 "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time
 "K:mm a, z"                       ->>  0:00 PM, PST
 "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM
 </pre>
 </blockquote>
 <strong>Code Sample:</strong>
 <pre>
 <blockquote>
 SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
 pdt.setStartRule(DateFields.APRIL, 1, DateFields.SUNDAY, 2*60*60*1000);
 pdt.setEndRule(DateFields.OCTOBER, -1, DateFields.SUNDAY, 2*60*60*1000);
 // Format the current time.
 SimpleDateFormat formatter
     = new SimpleDateFormat ("yyyy.mm.dd e 'at' hh:mm:ss a zzz");
 Date currentTime_1 = new Date();
 String dateString = formatter.format(currentTime_1);
 // Parse the previous string back into a Date.
 ParsePosition pos = new ParsePosition(0);
 Date currentTime_2 = formatter.parse(dateString, pos);
 </pre>
 </blockquote>
 In the example, the time value <code>currentTime_2</code> obtained from
 parsing will be equal to <code>currentTime_1</code>. However, they may not be
 equal if the am/pm marker 'a' is left out from the format pattern while
 the "hour in am/pm" pattern symbol is used. This information loss can
 happen when formatting the time in PM.
 <p>
 When parsing a date string using the abbreviated year pattern,
 SimpleDateFormat must interpret the abbreviated year
 relative to some century.  It does this by adjusting dates to be
 within 80 years before and 20 years after the time the SimpleDateFormat
 instance is created. For example, using a pattern of MM/dd/yy and a
 SimpleDateFormat instance created on Jan 1, 1997,  the string
 "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64"
 would be interpreted as May 4, 1964.
 During parsing, only strings consisting of exactly two digits, as defined by
 <code>Character.isDigit(char)</code>, will be parsed into the default century.
 Any other numeric string, such as a one digit string, a three or more digit
 string, or a two digit string that isn't all digits (for example, "-1"), is
 interpreted literally.  So "01/02/3" or "01/02/003" are parsed, using the
 same pattern, as Jan 2, 3 AD.  Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.
 <p>
 For time zones that have no names, use strings GMT+hours:minutes or
 GMT-hours:minutes.
 <p>
 The calendar defines what is the first day of the week, the first week
 of the year, whether hours are zero based or not (0 vs 12 or 24), and the
 time zone. There is one common decimal format to handle all the numbers;
 the digit count is handled programmatically according to the pattern.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.util.Calendar.html#_top_">Calendar</a>, <a href="java.util.GregorianCalendar.html#_top_">GregorianCalendar</a>, <a href="java.util.TimeZone.html#_top_">TimeZone</a>, <a href="java.text.DateFormat.html#_top_">DateFormat</a>, <a href="java.text.DateFormatSymbols.html#_top_">DateFormatSymbols</a>, <a href="java.text.DecimalFormat.html#_top_">DecimalFormat</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SimpleDateFormat()"><b>SimpleDateFormat</b></a>()
  <dd>  Construct a SimpleDateFormat using the default pattern for the default
 locale.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SimpleDateFormat(java.lang.String)"><b>SimpleDateFormat</b></a>(String)
  <dd>  Construct a SimpleDateFormat using the given pattern in the default
 locale.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SimpleDateFormat(java.lang.String, java.text.DateFormatSymbols)"><b>SimpleDateFormat</b></a>(String, DateFormatSymbols)
  <dd>  Construct a SimpleDateFormat using the given pattern and
 locale-specific symbol data.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#SimpleDateFormat(java.lang.String, java.util.Locale)"><b>SimpleDateFormat</b></a>(String, Locale)
  <dd>  Construct a SimpleDateFormat using the given pattern and locale.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#applyLocalizedPattern(java.lang.String)"><b>applyLocalizedPattern</b></a>(String)
  <dd>  Apply the given localized pattern string to this date format.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#applyPattern(java.lang.String)"><b>applyPattern</b></a>(String)
  <dd>  Apply the given unlocalized pattern string to this date format.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#clone()"><b>clone</b></a>()
  <dd>  Overrides Cloneable

  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#equals(java.lang.Object)"><b>equals</b></a>(Object)
  <dd>  Override equals.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#format(java.util.Date, java.lang.StringBuffer, java.text.FieldPosition)"><b>format</b></a>(Date, StringBuffer, FieldPosition)
  <dd>  Overrides DateFormat
 <p>Formats a date or time, which is the standard millis
 since January 1, 1970, 00:00:00 GMT.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getDateFormatSymbols()"><b>getDateFormatSymbols</b></a>()
  <dd>  Gets the date/time formatting data.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#hashCode()"><b>hashCode</b></a>()
  <dd>  Override hashCode.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#parse(java.lang.String, java.text.ParsePosition)"><b>parse</b></a>(String, ParsePosition)
  <dd>  Overrides DateFormat
 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setDateFormatSymbols(java.text.DateFormatSymbols)"><b>setDateFormatSymbols</b></a>(DateFormatSymbols)
  <dd>  Allows you to set the date/time formatting data.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toLocalizedPattern()"><b>toLocalizedPattern</b></a>()
  <dd>  Return a localized pattern string describing this date format.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toPattern()"><b>toPattern</b></a>()
  <dd>  Return a pattern string describing this date format.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="SimpleDateFormat"></a>
<a name="SimpleDateFormat()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>SimpleDateFormat</b>
<pre>
 public SimpleDateFormat()
</pre>
<dl>
  <dd> Construct a SimpleDateFormat using the default pattern for the default
 locale.  <b>Note:</b> Not all locales support SimpleDateFormat; for full
 generality, use the factory methods in the DateFormat class.
<p>
  <dd><dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.text.DateFormat.html#_top_">DateFormat</a>
  </dl></dd>
</dl>
<a name="SimpleDateFormat(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>SimpleDateFormat</b>
<pre>
 public SimpleDateFormat(<a href="java.lang.String.html#_top_">String</a> pattern)
</pre>
<dl>
  <dd> Construct a SimpleDateFormat using the given pattern in the default
 locale.  <b>Note:</b> Not all locales support SimpleDateFormat; for full
 generality, use the factory methods in the DateFormat class.
<p>
</dl>
<a name="SimpleDateFormat(java.lang.String, java.util.Locale)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>SimpleDateFormat</b>
<pre>
 public SimpleDateFormat(<a href="java.lang.String.html#_top_">String</a> pattern,
                         <a href="java.util.Locale.html#_top_">Locale</a> loc)
</pre>
<dl>
  <dd> Construct a SimpleDateFormat using the given pattern and locale.
 <b>Note:</b> Not all locales support SimpleDateFormat; for full
 generality, use the factory methods in the DateFormat class.
<p>
</dl>
<a name="SimpleDateFormat(java.lang.String, java.text.DateFormatSymbols)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>SimpleDateFormat</b>
<pre>
 public SimpleDateFormat(<a href="java.lang.String.html#_top_">String</a> pattern,
                         <a href="java.text.DateFormatSymbols.html#_top_">DateFormatSymbols</a> formatData)
</pre>
<dl>
  <dd> Construct a SimpleDateFormat using the given pattern and
 locale-specific symbol data.
<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="format(java.util.Date, java.lang.StringBuffer, java.text.FieldPosition)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="format"><b>format</b></a>
<pre>
 public <a href="java.lang.StringBuffer.html#_top_">StringBuffer</a> format(<a href="java.util.Date.html#_top_">Date</a> date,
                            <a href="java.lang.StringBuffer.html#_top_">StringBuffer</a> toAppendTo,
                            <a href="java.text.FieldPosition.html#_top_">FieldPosition</a> pos)
</pre>
<dl>
  <dd> Overrides DateFormat
 <p>Formats a date or time, which is the standard millis
 since January 1, 1970, 00:00:00 GMT.
 <p>Example: using the US locale:
 "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> 1996.07.10 AD at 15:08:56 PDT
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> date - the date-time value to be formatted into a date-time string.
    <dd> toAppendTo - where the new date-time text is to be appended.
    <dd> pos - the formatting position. On input: an alignment field,
 if desired. On output: the offsets of the alignment field.
    <dt> <b>Returns:</b>
    <dd> the formatted date-time string.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.text.DateFormat.html#format(java.util.Date, java.lang.StringBuffer, java.text.FieldPosition)">format</a> in class <a href="java.text.DateFormat.html#_top_">DateFormat</a>
    <dt> <b>See Also:</b>
    <dd> DateFormat
  </dl></dd>
</dl>
<a name="parse(java.lang.String, java.text.ParsePosition)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="parse"><b>parse</b></a>
<pre>
 public <a href="java.util.Date.html#_top_">Date</a> parse(<a href="java.lang.String.html#_top_">String</a> text,
                   <a href="java.text.ParsePosition.html#_top_">ParsePosition</a> pos)
</pre>
<dl>
  <dd> Overrides DateFormat
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.text.DateFormat.html#parse(java.lang.String, java.text.ParsePosition)">parse</a> in class <a href="java.text.DateFormat.html#_top_">DateFormat</a>
    <dt> <b>See Also:</b>
    <dd> DateFormat
  </dl></dd>
</dl>
<a name="toPattern()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toPattern"><b>toPattern</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toPattern()
</pre>
<dl>
  <dd> Return a pattern string describing this date format.
<p>
</dl>
<a name="toLocalizedPattern()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toLocalizedPattern"><b>toLocalizedPattern</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> toLocalizedPattern()
</pre>
<dl>
  <dd> Return a localized pattern string describing this date format.
<p>
</dl>
<a name="applyPattern(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="applyPattern"><b>applyPattern</b></a>
<pre>
 public void applyPattern(<a href="java.lang.String.html#_top_">String</a> pattern)
</pre>
<dl>
  <dd> Apply the given unlocalized pattern string to this date format.
<p>
</dl>
<a name="applyLocalizedPattern(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="applyLocalizedPattern"><b>applyLocalizedPattern</b></a>
<pre>
 public void applyLocalizedPattern(<a href="java.lang.String.html#_top_">String</a> pattern)
</pre>
<dl>
  <dd> Apply the given localized pattern string to this date format.
<p>
</dl>
<a name="getDateFormatSymbols()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getDateFormatSymbols"><b>getDateFormatSymbols</b></a>
<pre>
 public <a href="java.text.DateFormatSymbols.html#_top_">DateFormatSymbols</a> getDateFormatSymbols()
</pre>
<dl>
  <dd> Gets the date/time formatting data.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a copy of the date-time formatting data associated
 with this date-time formatter.
  </dl></dd>
</dl>
<a name="setDateFormatSymbols(java.text.DateFormatSymbols)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setDateFormatSymbols"><b>setDateFormatSymbols</b></a>
<pre>
 public void setDateFormatSymbols(<a href="java.text.DateFormatSymbols.html#_top_">DateFormatSymbols</a> newFormatSymbols)
</pre>
<dl>
  <dd> Allows you to set the date/time formatting data.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> newFormatData - the given date-time formatting data.
  </dl></dd>
</dl>
<a name="clone()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="clone"><b>clone</b></a>
<pre>
 public <a href="java.lang.Object.html#_top_">Object</a> clone()
</pre>
<dl>
  <dd> Overrides Cloneable
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.text.DateFormat.html#clone()">clone</a> in class <a href="java.text.DateFormat.html#_top_">DateFormat</a>
  </dl></dd>
</dl>
<a name="hashCode()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="hashCode"><b>hashCode</b></a>
<pre>
 public int hashCode()
</pre>
<dl>
  <dd> Override hashCode.
 Generates the hash code for the SimpleDateFormat object
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.text.DateFormat.html#hashCode()">hashCode</a> in class <a href="java.text.DateFormat.html#_top_">DateFormat</a>
  </dl></dd>
</dl>
<a name="equals(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="equals"><b>equals</b></a>
<pre>
 public boolean equals(<a href="java.lang.Object.html#_top_">Object</a> obj)
</pre>
<dl>
  <dd> Override equals.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.text.DateFormat.html#equals(java.lang.Object)">equals</a> in class <a href="java.text.DateFormat.html#_top_">DateFormat</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="java.text.RuleBasedCollator.html#_top_">Previous</a>  <a href="java.text.StringCharacterIterator.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
