mysql 日期时间函数

sec_to_time() 是一个 MySQL 日期/时间函数。它用于将给定的秒转换为时间。

语法

select sec_to_time(second); 

    参数:

    second:获取时间的秒值。

    示例 1

    select sec_to_time(2000); 

      输出:

      mysql> select sec_to_time(2000);
      +-------------------+
      | sec_to_time(2000) |
      +-------------------+
      | 00:33:20          |
      +-------------------+
      1 row in set (0.00 sec)
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6

      示例 2

      select sec_to_time(40); 

        输出:

        mysql> select sec_to_time(40);
        +-----------------+
        | sec_to_time(40) |
        +-----------------+
        | 00:00:40        |
        +-----------------+
        1 row in set (0.00 sec)
        • 1
        • 2
        • 3
        • 4
        • 5
        • 6