Java Doc for DateParser.java in  » 6.0-JDK-Modules » j2me » com » sun » cdc » io » 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 » 6.0 JDK Modules » j2me » com.sun.cdc.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.cdc.io.DateParser

DateParser
public class DateParser (Code)
This class implements somewhat of a subset of the J2SE Date class. However, since the semantics of parse() is slightly different (DateParser will not handle dates prior to 1/1/1970, amd to be able to provide methods that will set timezone and DST information, it is called DateParser.


Field Summary
protected  intday
    
protected  inthour
    
protected  intmilli
    
protected  intminute
    
protected  intmonth
    
protected  intsecond
    
protected static  inttz_offset
    
protected  intyear
    

Constructor Summary
 DateParser(int year, int month, int day, int hour, int minute, int second)
     Allocates a DateParser object and initializes it so that it represents the instant at the start of the second specified by the year, month, date, hrs, min, and sec arguments, in the local time zone.
 DateParser(String s)
     Allocates a DateParser object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the DateParser.parse method.

Method Summary
 intgetDay()
     Return the day of the month represented by this date.
 intgetHour()
     Return the hour represented by this date.
 intgetMinute()
     Return the minute represented by this date.
 intgetMonth()
     Return the month represented by this date.
 intgetSecond()
     Return the second represented by this date.
 longgetTime()
     Return the number of milliseconds since 1/1/1970 represented by this date.
 intgetYear()
     Return the year represented by this date.
public static  longparse(String s)
     Attempts to interpret the string s as a representation of a date and time.
static  voidsetTimeZone(String tz)
     Set the local time zone for the DateParser class. tz must in abbreviated format, e.g.

Field Detail
day
protected int day(Code)



hour
protected int hour(Code)



milli
protected int milli(Code)



minute
protected int minute(Code)



month
protected int month(Code)



second
protected int second(Code)



tz_offset
protected static int tz_offset(Code)



year
protected int year(Code)




Constructor Detail
DateParser
DateParser(int year, int month, int day, int hour, int minute, int second)(Code)
Allocates a DateParser object and initializes it so that it represents the instant at the start of the second specified by the year, month, date, hrs, min, and sec arguments, in the local time zone.
Parameters:
  year - the year, >= 1583.
Parameters:
  month - the month between 0-11.
Parameters:
  date - the day of the month between 1-31.
Parameters:
  hrs - the hours between 0-23.
Parameters:
  min - the minutes between 0-59.
Parameters:
  sec - the seconds between 0-59.



DateParser
DateParser(String s)(Code)
Allocates a DateParser object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the DateParser.parse method.
Parameters:
  s - a string representation of the date.
See Also:   com.nttdocomo.DateParser.parse(java.lang.String)




Method Detail
getDay
int getDay()(Code)
Return the day of the month represented by this date.



getHour
int getHour()(Code)
Return the hour represented by this date.



getMinute
int getMinute()(Code)
Return the minute represented by this date.



getMonth
int getMonth()(Code)
Return the month represented by this date.



getSecond
int getSecond()(Code)
Return the second represented by this date.



getTime
long getTime()(Code)
Return the number of milliseconds since 1/1/1970 represented by this date.



getYear
int getYear()(Code)
Return the year represented by this date.



parse
public static long parse(String s)(Code)
Attempts to interpret the string s as a representation of a date and time. If the attempt is successful, the time indicated is returned represented as teh distance, measured in milliseconds, of that time from the epoch (00:00:00 GMT on January 1, 1970). If the attempt fails, an IllegalArgumentException is thrown.

It accepts many syntaxes; in particular, it recognizes the IETF standard date syntax: "Sat, 12 Aug 1995 13:30:00 GMT". It also understands the continental U.S. time-zone abbreviations, but for general use, a time-zone offset should be used: "Sat, 12 Aug 1995 13:30:00 GMT+0430" (4 hours, 30 minutes west of the Greenwich meridian). If no time zone is specified, the local time zone is assumed. GMT and UTC are considered equivalent.

The string s is processed from left to right, looking for data of interest. Any material in s that is within the ASCII parenthesis characters ( and ) is ignored. Parentheses may be nested. Otherwise, the only characters permitted within s are these ASCII characters:

 abcdefghijklmnopqrstuvwxyz
 ABCDEFGHIJKLMNOPQRSTUVWXYZ
 0123456789,+-:/
and whitespace characters.

A consecutive sequence of decimal digits is treated as a decimal number:

  • If a number is preceded by + or - and a year has already been recognized, then the number is a time-zone offset. If the number is less than 24, it is an offset measured in hours. Otherwise, it is regarded as an offset in minutes, expressed in 24-hour time format without punctuation. A preceding - means a westward offset. Time zone offsets are always relative to UTC (Greenwich). Thus, for example, -5 occurring in the string would mean "five hours west of Greenwich" and +0430 would mean "four hours and thirty minutes east of Greenwich." It is permitted for the string to specify GMT, UT, or UTC redundantly-for example, GMT-5 or utc+0430.
  • If a number is greater than 70, it is regarded as a year number. It must be followed by a space, comma, slash, or end of string.
  • If the number is followed by a colon, it is regarded as an hour, unless an hour has already been recognized, in which case it is regarded as a minute.
  • If the number is followed by a slash, it is regarded as a month (it is decreased by 1 to produce a number in the range 0 to 11), unless a month has already been recognized, in which case it is regarded as a day of the month.
  • If the number is followed by whitespace, a comma, a hyphen, or end of string, then if an hour has been recognized but not a minute, it is regarded as a minute; otherwise, if a minute has been recognized but not a second, it is regarded as a second; otherwise, it is regarded as a day of the month.

A consecutive sequence of letters is regarded as a word and treated as follows:

  • A word that matches AM, ignoring case, is ignored (but the parse fails if an hour has not been recognized or is less than 1 or greater than 12).
  • A word that matches PM, ignoring case, adds 12 to the hour (but the parse fails if an hour has not been recognized or is less than 1 or greater than 12).
  • Any word that matches any prefix of SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, or SATURDAY, ignoring case, is ignored. For example, sat, Friday, TUE, and Thurs are ignored.
  • Otherwise, any word that matches any prefix of JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, or DECEMBER, ignoring case, and considering them in the order given here, is recognized as specifying a month and is converted to a number (0 to 11). For example, aug, Sept, april, and NOV are recognized as months. So is Ma, which is recognized as MARCH, not MAY.
  • Any word that matches GMT, UT, or UTC, ignoring case, is treated as referring to UTC.
  • Any word that matches EST, CST, MST, or PST, ignoring case, is recognized as referring to the time zone in North America that is five, six, seven, or eight hours west of Greenwich, respectively. Any word that matches EDT, CDT, MDT, or PDT, ignoring case, is recognized as referring to the same time zone, respectively, during daylight saving time.

Once the entire string s has been scanned, it is converted to a time result in one of two ways. If a time zone or time-zone offset has been recognized, then the year, month, day of month, hour, minute, and second are interpreted in UTC and then the time-zone offset is applied. Otherwise, the year, month, day of month, hour, minute, and second are interpreted in the local time zone.
Parameters:
  s - a string to be parsed as a date. the distance in milliseconds from January 1, 1970, 00:00:00 GMTrepresented by the string argument. Note that this method willthrow an IllegalArgumentException if the year indicated in s is less than 1583.




setTimeZone
static void setTimeZone(String tz)(Code)
Set the local time zone for the DateParser class. tz must in abbreviated format, e.g. "PST" for Pacific Standard Time.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) 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.