FROM_UNIXTIME
説明
Unix タイムスタンプを対応する TIME 形式に変換します。特殊なケース:
- unix_timestamp で現在サポートされている範囲は [0, 32536771199] です。この範囲外の Unix タイムスタンプは NULL を返します。
構文
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 |
+--------------------------------------------------+