您现在的位置: > 技术沙龙 > 程序设计 > Java > JDK API 参考 > java.sql > 类(Class) > Date
  • 相关软件
    >Date 创建者:webmaster 更新时间:2005-12-17 02:33


    该类是 java.util.Date 瘦包装器,它允许 JDBC 把该类作为 SQL DATE 值识别。
    它添加了格式化和语法分析操作来支持日期值的 JDBC 换码语法。


    类 java.sql.Date



    java.lang.Object
      |
      +----java.util.Date
          |
          +----java.sql.Date




    public class Date
    extends Date







    构造子索引



    Date(int, int, int)
    构造一个 Date


    Date(long)
    使用毫秒时间值构造一个 Date





    方法索引



    getHours()
    返回该日期表示的小时。
    getMinutes()
    返回该日期表示的分。
    getSeconds()
    返回该日期表示的秒。
    setHours(int)
    将该日期的小时设置为指定的数值。
    setMinutes(int)
    将该日期的分设置为指定的数值。
    setSeconds(int)
    将该日期的秒设置为指定的数值。
    setTime(long)
    使用毫秒时间值设置一个 Date


    toString()
    以 JDBC 日期换码格式格式化一个日期。


    valueOf(String)
    把 JDBC 时间换码格式的字符串转换成 Date 值






    构造子




    Date

    public Date(int year,
            int month,
            int day)


    构造一个 Date



     
    参数:
     
    year - 1900 年
     
    month - 0 到 11
     
    day - 1 到 31



    Date

    public Date(long date)


    使用毫秒时间值构造一个 Date



     
    参数:
     
    date - 自 GMT 1970年1月1日 00:00:00 起的毫秒数





    方法



    setTime

    public void setTime(long date)


    使用毫秒时间值设置一个 Date



     
    参数:
     
    date - 自 GMT 1970年1月1日 00:00:00 起的毫秒数
     
    覆盖:
     
    类 Date 中的 setTime



    valueOf

    public static Date valueOf(String s)


    把 JDBC 时间换码格式的字符串转换成 Date 值



     
    参数:
     
    格式为 "yyyy-mm-dd"的日期
     
    返回值:
     
    对应 Date



    toString

    public String toString()


    以 JDBC 日期换码格式格式化一个日期。



     
    返回值:
     
    一个格式为 yyyy-mm-dd 的字符串
     
    覆盖:
     
    类 Date 中的 toString



    getHours

    public int getHours()


    返回该日期表示的小时。



     
    覆盖:
     
    类 Date 中的
    getHours



    getMinutes

    public int getMinutes()


    返回该日期表示的分。



     
    覆盖:
     
    类 Date 中的
    getMinutes



    getSeconds

    public int getSeconds()


    返回该日期表示的秒。



     
    覆盖:
     
    类 Date 中的
    getSeconds



    setHours

    public void setHours(int i)


    将该日期的小时设置为指定的数值。



     
    覆盖:
     
    类 Date 中的
    setHours



    setMinutes

    public void setMinutes(int i)


    将该日期的分设置为指定的数值。



     
    覆盖:
     
    类 Date 中的
    setMinutes



    setSeconds

    public void setSeconds(int i)


    将该日期的秒设置为指定的数值。



     
    覆盖:
     
    类 Date 中的
    setSeconds

    相关文章
    本页查看次数: