java.text
Class SimpleDateFormat
- Cloneable, Serializable
SimpleDateFormat provides convenient methods for parsing and formatting
dates using Gregorian calendars (see java.util.GregorianCalendar).
This class is not thread-safe; external synchronisation should be applied
if an instance is to be accessed from multiple threads.
AM_PM_FIELD , DATE_FIELD , DAY_OF_WEEK_FIELD , DAY_OF_WEEK_IN_MONTH_FIELD , DAY_OF_YEAR_FIELD , DEFAULT , ERA_FIELD , FULL , HOUR0_FIELD , HOUR1_FIELD , HOUR_OF_DAY0_FIELD , HOUR_OF_DAY1_FIELD , LONG , MEDIUM , MILLISECOND_FIELD , MINUTE_FIELD , MONTH_FIELD , SECOND_FIELD , SHORT , TIMEZONE_FIELD , WEEK_OF_MONTH_FIELD , WEEK_OF_YEAR_FIELD , YEAR_FIELD , calendar , numberFormat |
SimpleDateFormat() - Constructs a SimpleDateFormat using the default pattern for
the default locale.
|
SimpleDateFormat(String pattern) - Creates a date formatter using the specified non-localized pattern,
with the default DateFormatSymbols for the default locale.
|
SimpleDateFormat(String pattern, DateFormatSymbols formatData) - Creates a date formatter using the specified non-localized
pattern.
|
SimpleDateFormat(String pattern, Locale locale) - Creates a date formatter using the specified non-localized pattern,
with the default DateFormatSymbols for the given locale.
|
clone , equals , format , format , format , getAvailableLocales , getCalendar , getDateInstance , getDateInstance , getDateInstance , getDateTimeInstance , getDateTimeInstance , getDateTimeInstance , getInstance , getNumberFormat , getTimeInstance , getTimeInstance , getTimeInstance , getTimeZone , hashCode , isLenient , parse , parse , parseObject , setCalendar , setLenient , setNumberFormat , setTimeZone |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
SimpleDateFormat
public SimpleDateFormat(String pattern,
Locale locale)
Creates a date formatter using the specified non-localized pattern,
with the default DateFormatSymbols for the given locale.
pattern
- the non-localized pattern to use.locale
- the locale to use for the formatting symbols.
clone
public Object clone()
Returns a copy of this instance of
SimpleDateFormat
. The copy contains
clones of the formatting symbols and the 2-digit
year century start date.
- clone in interface DateFormat
equals
public boolean equals(Object o)
This methods tests whether the specified object is equal to this
object. This will be true if and only if the specified object:
- Is not
null
. - Is an instance of
SimpleDateFormat
. - Is equal to this object at the superclass (i.e.,
DateFormat
)
level. - Has the same formatting pattern.
- Is using the same formatting symbols.
- Is using the same century for two digit years.
- equals in interface DateFormat
o
- The object to compare for equality against.
true
if the specified object is equal to this object,
false
otherwise.
parse
public Date parse(String dateStr,
ParsePosition pos)
This method parses the specified string into a date.
- parse in interface DateFormat
dateStr
- The date string to parse.pos
- The input and output parse position
- The parsed date, or
null
if the string cannot be
parsed.
SimpleDateFormat.java -- A class for parsing/formating simple
date constructs
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.