Java Doc for DateFormat.java in  » Apache-Harmony-Java-SE » java-package » java » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.Format
      java.text.DateFormat

DateFormat
abstract public class DateFormat extends Format (Code)
DateFormat is the abstract superclass of formats which format and parse Dates.

Inner Class :public static class Field extends Format.Field

Field Summary
final public static  intAM_PM_FIELD
     Field constant.
final public static  intDATE_FIELD
     Field constant.
final public static  intDAY_OF_WEEK_FIELD
     Field constant.
final public static  intDAY_OF_WEEK_IN_MONTH_FIELD
     Field constant.
final public static  intDAY_OF_YEAR_FIELD
     Field constant.
final public static  intDEFAULT
     Format style constant.
final public static  intERA_FIELD
     Field constant.
final public static  intFULL
     Format style constant.
final public static  intHOUR0_FIELD
     Field constant.
final public static  intHOUR1_FIELD
     Field constant.
final public static  intHOUR_OF_DAY0_FIELD
     Field constant.
final public static  intHOUR_OF_DAY1_FIELD
     Field constant.
final public static  intLONG
     Format style constant.
final public static  intMEDIUM
     Format style constant.
final public static  intMILLISECOND_FIELD
     Field constant.
final public static  intMINUTE_FIELD
     Field constant.
final public static  intMONTH_FIELD
     Field constant.
final public static  intSECOND_FIELD
     Field constant.
final public static  intSHORT
     Format style constant.
final public static  intTIMEZONE_FIELD
     Field constant.
final public static  intWEEK_OF_MONTH_FIELD
     Field constant.
final public static  intWEEK_OF_YEAR_FIELD
     Field constant.
final public static  intYEAR_FIELD
     Field constant.
protected  Calendarcalendar
    
protected  NumberFormatnumberFormat
    

Constructor Summary
protected  DateFormat()
     Constructs a new instance of DateFormat.

Method Summary
public  Objectclone()
     Answers a new instance of DateFormat with the same properties.
public  booleanequals(Object object)
     Compares the specified object to this DateFormat and answer if they are equal.
final public  StringBufferformat(Object object, StringBuffer buffer, FieldPosition field)
     Formats the specified object into the specified StringBuffer using the rules of this DateFormat.
final public  Stringformat(Date date)
     Formats the specified Date using the rules of this DateFormat.
abstract public  StringBufferformat(Date date, StringBuffer buffer, FieldPosition field)
     Formats the specified Date into the specified StringBuffer using the rules of this DateFormat.
public static  Locale[]getAvailableLocales()
     Gets the list of installed Locales which support DateFormat.
public  CalendargetCalendar()
     Answers the Calendar used by this DateFormat.
final public static  DateFormatgetDateInstance()
     Answers a DateFormat instance for formatting and parsing dates in the DEFAULT style for the default Locale.
final public static  DateFormatgetDateInstance(int style)
     Answers a DateFormat instance for formatting and parsing dates in the specified style for the default Locale.
final public static  DateFormatgetDateInstance(int style, Locale locale)
     Answers a DateFormat instance for formatting and parsing dates in the specified style for the specified Locale.
final public static  DateFormatgetDateTimeInstance()
     Answers a DateFormat instance for formatting and parsing dates and times in the DEFAULT style for the default Locale.
final public static  DateFormatgetDateTimeInstance(int dateStyle, int timeStyle)
     Answers a DateFormat instance for the formatting and parsing of both dates and times in the manner appropriate to the default Locale.
final public static  DateFormatgetDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
     Answers a DateFormat instance for formatting and parsing dates and times in the specified styles for the specified Locale.
final public static  DateFormatgetInstance()
     Answers a DateFormat instance for formatting and parsing dates and times in the SHORT style for the default Locale.
public  NumberFormatgetNumberFormat()
     Answers the NumberFormat used by this DateFormat.
static  StringgetStyleName(int style)
    
final public static  DateFormatgetTimeInstance()
     Answers a DateFormat instance for formatting and parsing times in the DEFAULT style for the default Locale.
final public static  DateFormatgetTimeInstance(int style)
     Answers a DateFormat instance for formatting and parsing times in the specified style for the default Locale.
final public static  DateFormatgetTimeInstance(int style, Locale locale)
     Answers a DateFormat instance for formatting and parsing times in the specified style for the specified Locale.
public  TimeZonegetTimeZone()
     Answers the TimeZone of the Calendar used by this DateFormat.
public  inthashCode()
     Answers an integer hash code for the receiver.
public  booleanisLenient()
     Answers if the Calendar used by this DateFormat is lenient.
public  Dateparse(String string)
     Parse a Date from the specified String using the rules of this DateFormat.
abstract public  Dateparse(String string, ParsePosition position)
     Parse a Date from the specified String starting at the index specified by the ParsePosition.
public  ObjectparseObject(String string, ParsePosition position)
     Parse a Date from the specified String starting at the index specified by the ParsePosition.
public  voidsetCalendar(Calendar cal)
     Sets the Calendar used by this DateFormat.
public  voidsetLenient(boolean value)
     Sets if the Calendar used by this DateFormat is lenient.
public  voidsetNumberFormat(NumberFormat format)
     Sets the NumberFormat used by this DateFormat.
public  voidsetTimeZone(TimeZone timezone)
     Sets the TimeZone of the Calendar used by this DateFormat.

Field Detail
AM_PM_FIELD
final public static int AM_PM_FIELD(Code)
Field constant.



DATE_FIELD
final public static int DATE_FIELD(Code)
Field constant.



DAY_OF_WEEK_FIELD
final public static int DAY_OF_WEEK_FIELD(Code)
Field constant.



DAY_OF_WEEK_IN_MONTH_FIELD
final public static int DAY_OF_WEEK_IN_MONTH_FIELD(Code)
Field constant.



DAY_OF_YEAR_FIELD
final public static int DAY_OF_YEAR_FIELD(Code)
Field constant.



DEFAULT
final public static int DEFAULT(Code)
Format style constant.



ERA_FIELD
final public static int ERA_FIELD(Code)
Field constant.



FULL
final public static int FULL(Code)
Format style constant.



HOUR0_FIELD
final public static int HOUR0_FIELD(Code)
Field constant.



HOUR1_FIELD
final public static int HOUR1_FIELD(Code)
Field constant.



HOUR_OF_DAY0_FIELD
final public static int HOUR_OF_DAY0_FIELD(Code)
Field constant.



HOUR_OF_DAY1_FIELD
final public static int HOUR_OF_DAY1_FIELD(Code)
Field constant.



LONG
final public static int LONG(Code)
Format style constant.



MEDIUM
final public static int MEDIUM(Code)
Format style constant.



MILLISECOND_FIELD
final public static int MILLISECOND_FIELD(Code)
Field constant.



MINUTE_FIELD
final public static int MINUTE_FIELD(Code)
Field constant.



MONTH_FIELD
final public static int MONTH_FIELD(Code)
Field constant.



SECOND_FIELD
final public static int SECOND_FIELD(Code)
Field constant.



SHORT
final public static int SHORT(Code)
Format style constant.



TIMEZONE_FIELD
final public static int TIMEZONE_FIELD(Code)
Field constant.



WEEK_OF_MONTH_FIELD
final public static int WEEK_OF_MONTH_FIELD(Code)
Field constant.



WEEK_OF_YEAR_FIELD
final public static int WEEK_OF_YEAR_FIELD(Code)
Field constant.



YEAR_FIELD
final public static int YEAR_FIELD(Code)
Field constant.



calendar
protected Calendar calendar(Code)



numberFormat
protected NumberFormat numberFormat(Code)




Constructor Detail
DateFormat
protected DateFormat()(Code)
Constructs a new instance of DateFormat.




Method Detail
clone
public Object clone()(Code)
Answers a new instance of DateFormat with the same properties. a shallow copy of this DateFormat
See Also:   java.lang.Cloneable



equals
public boolean equals(Object object)(Code)
Compares the specified object to this DateFormat and answer if they are equal. The object must be an instance of DateFormat with the same properties.
Parameters:
  object - the object to compare with this object true if the specified object is equal to this DateFormat, falseotherwise
See Also:   DateFormat.hashCode



format
final public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)
Formats the specified object into the specified StringBuffer using the rules of this DateFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
Parameters:
  object - the object to format, must be a Date or a Number. If theobject is a Number, a Date is constructed using thelongValue() of the Number.
Parameters:
  buffer - the StringBuffer
Parameters:
  field - the FieldPosition the StringBuffer parameter buffer
exception:
  IllegalArgumentException - when the object is not a Date or a Number



format
final public String format(Date date)(Code)
Formats the specified Date using the rules of this DateFormat.
Parameters:
  date - the Date to format the formatted String



format
abstract public StringBuffer format(Date date, StringBuffer buffer, FieldPosition field)(Code)
Formats the specified Date into the specified StringBuffer using the rules of this DateFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
Parameters:
  date - the Date to format
Parameters:
  buffer - the StringBuffer
Parameters:
  field - the FieldPosition the StringBuffer parameter buffer



getAvailableLocales
public static Locale[] getAvailableLocales()(Code)
Gets the list of installed Locales which support DateFormat. an array of Locale



getCalendar
public Calendar getCalendar()(Code)
Answers the Calendar used by this DateFormat. a Calendar



getDateInstance
final public static DateFormat getDateInstance()(Code)
Answers a DateFormat instance for formatting and parsing dates in the DEFAULT style for the default Locale. a DateFormat



getDateInstance
final public static DateFormat getDateInstance(int style)(Code)
Answers a DateFormat instance for formatting and parsing dates in the specified style for the default Locale.
Parameters:
  style - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT a DateFormat



getDateInstance
final public static DateFormat getDateInstance(int style, Locale locale)(Code)
Answers a DateFormat instance for formatting and parsing dates in the specified style for the specified Locale.
Parameters:
  style - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
Parameters:
  locale - the Locale a DateFormat



getDateTimeInstance
final public static DateFormat getDateTimeInstance()(Code)
Answers a DateFormat instance for formatting and parsing dates and times in the DEFAULT style for the default Locale. a DateFormat



getDateTimeInstance
final public static DateFormat getDateTimeInstance(int dateStyle, int timeStyle)(Code)
Answers a DateFormat instance for the formatting and parsing of both dates and times in the manner appropriate to the default Locale.
Parameters:
  dateStyle - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
Parameters:
  timeStyle - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT a DateFormat



getDateTimeInstance
final public static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)(Code)
Answers a DateFormat instance for formatting and parsing dates and times in the specified styles for the specified Locale.
Parameters:
  dateStyle - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
Parameters:
  timeStyle - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
Parameters:
  locale - the Locale a DateFormat



getInstance
final public static DateFormat getInstance()(Code)
Answers a DateFormat instance for formatting and parsing dates and times in the SHORT style for the default Locale. a DateFormat



getNumberFormat
public NumberFormat getNumberFormat()(Code)
Answers the NumberFormat used by this DateFormat. a NumberFormat



getStyleName
static String getStyleName(int style)(Code)



getTimeInstance
final public static DateFormat getTimeInstance()(Code)
Answers a DateFormat instance for formatting and parsing times in the DEFAULT style for the default Locale. a DateFormat



getTimeInstance
final public static DateFormat getTimeInstance(int style)(Code)
Answers a DateFormat instance for formatting and parsing times in the specified style for the default Locale.
Parameters:
  style - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT a DateFormat



getTimeInstance
final public static DateFormat getTimeInstance(int style, Locale locale)(Code)
Answers a DateFormat instance for formatting and parsing times in the specified style for the specified Locale.
Parameters:
  style - one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
Parameters:
  locale - the Locale a DateFormat



getTimeZone
public TimeZone getTimeZone()(Code)
Answers the TimeZone of the Calendar used by this DateFormat. a TimeZone



hashCode
public int hashCode()(Code)
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method. the receiver's hash
See Also:   DateFormat.equals



isLenient
public boolean isLenient()(Code)
Answers if the Calendar used by this DateFormat is lenient. true when the Calendar is lenient, false otherwise



parse
public Date parse(String string) throws ParseException(Code)
Parse a Date from the specified String using the rules of this DateFormat.
Parameters:
  string - the String to parse the Date resulting from the parse
exception:
  ParseException - when an error occurs during parsing



parse
abstract public Date parse(String string, ParsePosition position)(Code)
Parse a Date from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
Parameters:
  string - the String to parse
Parameters:
  position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred the Date resulting from the parse, or null if there is an error



parseObject
public Object parseObject(String string, ParsePosition position)(Code)
Parse a Date from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
Parameters:
  string - the String to parse
Parameters:
  position - the ParsePosition, updated on return with the index followingthe parsed text, or on error the index is unchanged and theerror index is set to the index where the error occurred the Date resulting from the parse, or null if there is an error



setCalendar
public void setCalendar(Calendar cal)(Code)
Sets the Calendar used by this DateFormat.
Parameters:
  cal - the Calendar



setLenient
public void setLenient(boolean value)(Code)
Sets if the Calendar used by this DateFormat is lenient.
Parameters:
  value - true to set the Calendar to be lenient, false otherwise



setNumberFormat
public void setNumberFormat(NumberFormat format)(Code)
Sets the NumberFormat used by this DateFormat.
Parameters:
  format - the NumberFormat



setTimeZone
public void setTimeZone(TimeZone timezone)(Code)
Sets the TimeZone of the Calendar used by this DateFormat.
Parameters:
  timezone - the TimeZone



Methods inherited from java.text.Format
public Object clone()(Code)(Java Doc)
String convertPattern(String template, String fromChars, String toChars, boolean check)(Code)(Java Doc)
final public String format(Object object)(Code)(Java Doc)
abstract public StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)(Code)(Java Doc)
public AttributedCharacterIterator formatToCharacterIterator(Object object)(Code)(Java Doc)
static Object getInternalField(String fieldName, Object target)(Code)(Java Doc)
public Object parseObject(String string) throws ParseException(Code)(Java Doc)
abstract public Object parseObject(String string, ParsePosition position)(Code)(Java Doc)
static boolean upTo(String string, ParsePosition position, StringBuffer buffer, char stop)(Code)(Java Doc)
static boolean upToWithQuotes(String string, ParsePosition position, StringBuffer buffer, char stop, char start)(Code)(Java Doc)

Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.