Changeset 1391 for branches/GNU/src/gcc/libjava/java/sql/Date.java
- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/java/sql/Date.java (modified) (2 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/java/sql/Date.java
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 36 36 exception statement from your version. */ 37 37 38 39 38 package java.sql; 40 39 … … 47 46 * @author Aaron M. Renn ([email protected]) 48 47 */ 49 public class Date extends java.util.Date 48 public class Date extends java.util.Date 50 49 { 50 51 51 52 /* 53 * Class Variables 54 */ 52 /** 53 * Used for parsing and formatting this date. 54 */ 55 private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 55 56 56 /** 57 * Used for parsing and formatting this date. 58 */ 59 private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 57 /** 58 * This method initializes a new instance of this class with the 59 * specified year, month, and day. 60 * 61 * @param year The year of this date minue 1900. 62 * @param month The month of this date (0-11). 63 * @param day The day of this date (1-31). 64 * 65 * @deprecated 66 */ 67 public Date(int year, int month, int day) 68 { 69 super(year, month, day); 70 } 60 71 61 /** 62 * This is the serialization UID for this class. 63 */ 64 private static final long serialVersionUID = 1511598038487230103L; 72 /** 73 * This method initializes a new instance of this class with the 74 * specified time value representing the number of seconds since 75 * Jan 1, 1970 at 12:00 midnight GMT. 76 * 77 * @param time The time value to intialize this date to. 78 */ 79 public Date(long date) 80 { 81 super(date); 82 } 65 83 66 /*************************************************************************/ 84 /** 85 * This method returns a new instance of this class by parsing a 86 * date in JDBC format into a Java date. 87 * 88 * @param str The string to parse. 89 * @return The resulting <code>java.sql.Date</code> value. 90 */ 91 public static Date valueOf(String str) 92 { 93 try 94 { 95 java.util.Date d = (java.util.Date) sdf.parseObject(str); 96 return(new Date(d.getTime())); 97 } 98 catch(Exception e) 99 { 100 return(null); 101 } 102 } 67 103 68 /* 69 * Class Methods 70 */ 71 72 /** 73 * This method returns a new instance of this class by parsing a 74 * date in JDBC format into a Java date. 75 * 76 * @param str The string to parse. 77 * 78 * @return The resulting <code>java.sql.Date</code> value. 79 */ 80 public static Date 81 valueOf(String str) 82 { 83 try 84 { 85 java.util.Date d = (java.util.Date)sdf.parseObject(str); 86 return(new Date(d.getTime())); 87 } 88 catch(Exception e) 89 { 90 return(null); 91 } 104 /** 105 * This method returns this date in JDBC format. 106 * 107 * @return This date as a string. 108 */ 109 public String toString() 110 { 111 return(sdf.format(this)); 112 } 92 113 } 93 94 /*************************************************************************/95 96 /*97 * Constructors98 */99 100 /**101 * This method initializes a new instance of this class with the102 * specified year, month, and day.103 *104 * @param year The year of this date minue 1900.105 * @param month The month of this date (0-11).106 * @param day The day of this date (1-31).107 *108 * @deprecated109 */110 public111 Date(int year, int month, int day)112 {113 super(year, month, day);114 }115 116 /*************************************************************************/117 118 /**119 * This method initializes a new instance of this class with the120 * specified time value representing the number of seconds since121 * Jan 1, 1970 at 12:00 midnight GMT.122 *123 * @param time The time value to intialize this date to.124 */125 public126 Date(long date)127 {128 super(date);129 }130 131 /*************************************************************************/132 133 /*134 * Instance Methods135 */136 137 /**138 * This method returns this date in JDBC format.139 *140 * @return This date as a string.141 */142 public String143 toString()144 {145 return(sdf.format(this));146 }147 148 } // class Date149 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
