According to the manual, the DATETIME field can be stored "As a string with
no delimiters in either 'YYYYMMDDHHMMSS' or 'YYMMDDHHMMSS' format, provided
that the string makes sense as a date."  So this should provide you with the
format you require.

TIMESTAMP was created so that we would NOT have to make an extra call to
NOW() when doing INSERTs

Finally, you replied directly to me, instead of the list, but I'll forward
to list here...

As for my 2 cents, I prefer TIMESTAMP to do as it does

-----Original Message-----
From: Hihn Jason [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:48 AM
To: 'Rick Emery'
Subject: RE: Problems with UPDATE in v3.23.49 (is this a bug)


Yes I did, but it is very long, and it was very long ago. 
Could someone please explain to me why this was done? It seems more
confusing to do this than to not do this. Why when you can just say "SET
field=NOW()" would anyone build this auto update of timestamps in? (the
kicker is you HAVE to do it for all timestamps in a schema past the first)
Additionally, what if I wanted the time stamp format (without formatting
(spaces, colons, and dashes)) (which I do)

A very illogical feature I must say... Anyone agree with me?

-----Original Message-----
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 11:34 AM
To: Hihn Jason; '[EMAIL PROTECTED]'
Subject: RE: Problems with UPDATE in v3.23.49 (is this a bug)


No, this is NOT a bug.

According to the manual (you read it, right?), TIMESTAMP is created so that
when a record is UPDATEd or INSERTed, the time of the change is entered into
the record.  If you want a date that does not changem use the DATE fiel

-----Original Message-----
From: Hihn Jason [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 10:33 AM
To: '[EMAIL PROTECTED]'
Subject: Problems with UPDATE in v3.23.49 (is this a bug)


I have a table whose schema contains:
id INTEGER AUTO_INCREMENT, 
gen_time TIMESTAMP, 
rec_time TIMESTAMP, 
repeats INTEGER DEFAULT 0, 
PRIMARY KEY (id), 
INDEX (rec_time))

When I do an:
UPDATE table SET repeats=repeats+1

gen_time gets updated as well:
mysql> select id, gen_time, rec_time, repeats from table;
+----+----------------+----------------+---------+
| id | gen_time       | rec_time       | repeats |
+----+----------------+----------------+---------+
|  1 | 20020404164500 | 20020405111308 |       0 |
+----+----------------+----------------+---------+
1 row in set (0.01 sec)

mysql> update table set repeats=repeats+1 where id='1';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update table set repeats=repeats+1 where id='1';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update table set repeats=repeats+1 where id='1';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select id, gen_time, rec_time, repeats from table;
+----+----------------+----------------+---------+
| id | gen_time       | rec_time       | repeats |
+----+----------------+----------------+---------+
|  1 | 20020405112158 | 20020405111308 |       3 |
+----+----------------+----------------+---------+
1 row in set (0.02 sec)

Is this a bug or am I forgetting something?



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to