here's a tip
create a script
the script will look something like this:
Code:
create table somedates2
( id tinyint not null primary key auto_increment
, date1 datetime
, date2 datetime
);
insert into somedates2 ( date1,date2 ) values
( '2004-05-11 12:00:00', '2004-05-12 12:00:00' )
, ( '2004-05-11 12:00:00', '2004-06-11 12:00:00' )
, ( '2004-05-11 12:00:00', '2005-05-11 12:00:00' )
, ( '2004-05-11 12:00:00', '2004-05-11 12:01:00' )
, ( '2004-05-11 12:00:00', '2004-05-11 13:00:00' )
, ( '2004-05-11 12:00:00', '2004-05-12 11:59:59' )
;
select id
, unix_timestamp(date2)
-unix_timestamp(date1) as unixdiff
, floor(
( unix_timestamp(date2)
-unix_timestamp(date1) ) / 86400
) as daysdiff
, unix_timestamp(date2)
-unix_timestamp(date1)
- floor(
( unix_timestamp(date2)
-unix_timestamp(date1) ) / 86400
) * 86400 as secondsdiff
from somedates2
what is the purpose of the script?
so that you can drop the table, and start all over again
make a change, re-run, didn't work?
drop the table, and start all over again
that way, you will not have to constantly futz with ALTER
now, this means you may have to (re)create several tables in the script, but i think it's a better testing methodology than trying to fix stuff that was fixed after a fix that didn't work...
Bookmarks