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


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


    类 java.sql.Time



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



    public class Time
    extends Date






    构造子索引



    Time(int, int, int)
    构造一个 Time 对象
    Time(long)
    使用毫秒时间值构造一个 Time



    方法索引



    getDate()
    返回该日期表示的月的日。
    getDay()
    返回该日期表示的星期。
    getMonth()
    返回该日期表示的月。
    getYear()
    返回该日期表示的年,并减去 1900。
    setDate(int)
    将该日期的月的日设置为指定的数值。
    setMonth(int)
    将该日期的月设置为指定的数值。
    setTime(long)
    使用毫秒时间值设置一个 Time 。


    setYear(int)
    设置该日期的年为指定数值加 1900。
    toString()
    以 JDBC 日期换码格式格式化一个 time 。
    valueOf(String)
    把 JDBC 时间换码格式的字符串转换成一个 Time 值




    构造子




    Time

    public Time(int hour,
                  int minute,
                  int second)


    构造一个 Time 对象



     
    参数:
     
    hour - 0 到 23
     
    minute - 0 到 59
     
    second - 0 到 59



    Time

    public Time(long time)


    使用毫秒时间值构造一个 Time 对象



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





    方法



    setTime

    public void setTime(long time)


    使用毫秒时间值设置一个 Time 。



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



    valueOf

    public static Time valueOf(String s)


    把 JDBC 时间换码格式的字符串转换成一个 Time 值



     
    参数:
     
    s - 格式为 "hh:mm:ss" 的时间
     
    返回值:
     
    相应的 Time



    toString

    public String toString()


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



     
    返回值:
     
    格式为 hh:mm:ss 的 String
    覆盖:
     
    类 Date 中的 toString


    getYear

    public int getYear()


    返回该日期表示的年,并减去 1900。



     
    覆盖:
     
    类 Date 中的 getYear



    getMonth

    public int getMonth()


    返回该日期表示的月。



     
    覆盖:
     
    类 Date 中的 getMonth



    getDay

    public int getDay()


    返回该日期表示的星期。



     
    覆盖:
     
    类 Date 中的 getDay



    getDate

    public int getDate()


    返回该日期表示的月的日。



     
    覆盖:
     
    类 Date 中的 getDate



    setYear

    public void setYear(int i)


    设置该日期的年为指定数值加 1900。



     
    覆盖:
     
    类 Date 中的 setYear



    setMonth

    public void setMonth(int i)


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



     
    覆盖:
     
    类 Date 中的 setMonth



    setDate

    public void setDate(int i)


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



     
    覆盖:
     
    类 Date 中的 setDate

    相关文章
    本页查看次数: