FROM_UNIXTIME
デスクリプション
UnixタイムスタンプをTIME形式に変換します。特殊なケース:
- unix_timestampで現在サポートされている範囲は[0, 32536771199]です。この範囲外のUnixタイムスタンプはNULLを返します。
Syntax
FROM_UNIXTIME(<unix_timestamp>[, <string_format>])
パラメータ
| Parameter | デスクリプション |
|---|---|
<unix_timestamp> | unix timestamp |
<string_format> | フォーマット形式。デフォルトは %Y-%m-%d %H:%i:%s です。 |
Return Value
指定された形式で日付を返します。
Examples
mysql> select from_unixtime(1196440219);
+---------------------------+
| from_unixtime(1196440219) |
+---------------------------+
| 2007-12-01 00:30:19 |
+---------------------------+
mysql> select from_unixtime(1196440219, 'yyyy-MM-dd HH:mm:ss');
+--------------------------------------------------+
| from_unixtime(1196440219, 'yyyy-MM-dd HH:mm:ss') |
+--------------------------------------------------+
| 2007-12-01 00:30:19 |
+--------------------------------------------------+
mysql> select from_unixtime(1196440219, '%Y-%m-%d');
+-----------------------------------------+
| from_unixtime(1196440219, '%Y-%m-%d') |
+-----------------------------------------+
| 2007-12-01 |
+-----------------------------------------+
mysql> select from_unixtime(1196440219, '%Y-%m-%d %H:%i:%s');
+--------------------------------------------------+
| from_unixtime(1196440219, '%Y-%m-%d %H:%i:%s') |
+--------------------------------------------------+
| 2007-12-01 00:30:19 |
+--------------------------------------------------+