List:General Discussion« Previous MessageNext Message »
From:Alex Krohn Date:March 16 1999 10:28am
Subject:odd date behavior..
View as plain text  
Hi,

This is due to my incorrect reading of how period_add works, but the
result was pretty odd, thought you might be interested:

mysql> create table test (a datetime);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test values (period_add(now(), 12));
Query OK, 1 row affected (0.05 sec)

mysql> select * from test;
+---------------------+
| a                   |
+---------------------+
| 2000-15-38 20:59:03 |
+---------------------+
1 row in set (0.00 sec)

on my linux system running 3.22.14b-gamma. I was quite surprised that
mysql would allow that bad date in there (even though it was due to my
programming error).

I've got it working properly using DATE_ADD(NOW(), INTERVAL 1 YEAR),
however is there a way to do the above nicely with 3.21.33 (where
date_add is not available).

Cheers,

Alex

--------------------  Gossamer Threads Inc.  ----------------------
Alex Krohn                        Email: alex@stripped
Internet Consultant               Phone: (604) 922-4536
http://www.gossamer-threads.com   Fax  : (604) 926-9320
PGP Public Key: http://www.gossamer-threads.com/pgpkey.txt
Page me Online: http://wwp.mirabilis.com/1591987
Thread
odd date behavior..Alex Krohn16 Mar
  • odd date behavior..Michael Widenius16 Mar
  • RE: Drumbeat 2000Jay Miller10 Jun