List:General Discussion« Previous MessageNext Message »
From:hsv Date:July 24 2012 3:20pm
Subject:RE: YEAR and time types
View as plain text  
>>>> 2012/07/23 11:54 -0700, Rick James >>>>
mysql> SELECT YEAR(NOW());
+-------------+
| YEAR(NOW()) |
+-------------+
|        2012 |
+-------------+

mysql> SELECT CONCAT('2012', '-01-01');
+--------------------------+
| CONCAT('2012', '-01-01') |
+--------------------------+
| 2012-01-01               |
+--------------------------+

To show that it acts like a DATE:
mysql> SELECT CONCAT('2012', '-01-01') - INTERVAL 1 day;
+-------------------------------------------+
| CONCAT('2012', '-01-01') - INTERVAL 1 day |
+-------------------------------------------+
| 2011-12-31                                |
+-------------------------------------------+
<<<<<<<<
No: I mean variables of type YEAR

Thread
YEAR and time typeshsv23 Jul
  • RE: YEAR and time typesRick James23 Jul
    • RE: YEAR and time typeshsv24 Jul
Re: YEAR and time typeshsv24 Jul
Re: YEAR and time typeshsv30 Jul