Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (22 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libjava/java/sql/Date.java

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    3636exception statement from your version. */
    3737
    38 
    3938package java.sql;
    4039
     
    4746  * @author Aaron M. Renn ([email protected])
    4847  */
    49 public class Date extends java.util.Date
     48public class Date extends java.util.Date
    5049{
     50
    5151
    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");
    5556
    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  }
    6071
    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  }
    6583
    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  }
    67103
    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  }
    92113}
    93 
    94 /*************************************************************************/
    95 
    96 /*
    97  * Constructors
    98  */
    99 
    100 /**
    101   * This method initializes a new instance of this class with the
    102   * 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   * @deprecated
    109   */
    110 public
    111 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 the
    120   * specified time value representing the number of seconds since
    121   * Jan 1, 1970 at 12:00 midnight GMT.
    122   *
    123   * @param time The time value to intialize this date to.
    124   */
    125 public
    126 Date(long date)
    127 {
    128   super(date);
    129 }
    130 
    131 /*************************************************************************/
    132 
    133 /*
    134  * Instance Methods
    135  */
    136 
    137 /**
    138   * This method returns this date in JDBC format.
    139   *
    140   * @return This date as a string.
    141   */
    142 public String
    143 toString()
    144 {
    145   return(sdf.format(this));
    146 }
    147 
    148 } // class Date
    149 
Note: See TracChangeset for help on using the changeset viewer.