From: Rick James Date: July 23 2012 6:54pm Subject: RE: YEAR and time types List-Archive: http://lists.mysql.com/mysql/227880 Message-Id: <2E7DD7ADE53B044C8C8BCD9C5829E1EB1489DB956B@SP2-EX07VS01.ds.corp.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 | +-------------------------------------------+ > -----Original Message----- > From: hsv@stripped [mailto:hsv@stripped] > Sent: Monday, July 23, 2012 5:59 AM > To: mysql@stripped > Subject: YEAR and time types >=20 > A director s term ends in a given year, but at no given time of year; > depends on the yearly meeting. >=20 > I thought I would try YEAR to record it--but, in spite of > http://dev.mysql.com/doc/refman/5.5/en/year.html , simply assigning > NOW() to such a type does not work. There is also no implicit > conversion to DATE. All in all, it behaves as a small integer, not a > time type. For my end it is much less good than 'year-00-00', something > already slightly obscure. >=20 >=20 > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql