MySQL Tutorial/Date Time Functions/MAKEDATE
Содержание
MAKEDATE(year,dayofyear) returns a date, given year and day-of-year values.
mysql>
mysql> SELECT MAKEDATE(2001,31);
+-------------------+
| MAKEDATE(2001,31) |
+-------------------+
| 2001-01-31 |
+-------------------+
1 row in set (0.00 sec)
mysql>
SELECT MAKEDATE(2001,0);
mysql>
mysql>
mysql> SELECT MAKEDATE(2001,0);
+------------------+
| MAKEDATE(2001,0) |
+------------------+
| NULL |
+------------------+
1 row in set (0.00 sec)
mysql>
select MAKEDATE(2001,32);
mysql>
mysql>
mysql> select MAKEDATE(2001,32);
+-------------------+
| MAKEDATE(2001,32) |
+-------------------+
| 2001-02-01 |
+-------------------+
1 row in set (0.00 sec)
mysql>
SELECT MAKEDATE(2001,365);
mysql>
mysql>
mysql> SELECT MAKEDATE(2001,365);
+--------------------+
| MAKEDATE(2001,365) |
+--------------------+
| 2001-12-31 |
+--------------------+
1 row in set (0.00 sec)
mysql>
select MAKEDATE(2004,365);
mysql>
mysql>
mysql> select MAKEDATE(2004,365);
+--------------------+
| MAKEDATE(2004,365) |
+--------------------+
| 2004-12-30 |
+--------------------+
1 row in set (0.00 sec)
mysql>