June 14th, 2000, 01:49 PM
There seem to be alot of ways to perform date subtraction but one way that I do not see in the documentation or posts is this:
I have a date in the future (TIMESTAMP1). I want to find out how many days,hours,minutes,seconds between NOW() and TIMESTAMP1.
All of the functions I have seen deal with either the difference in seconds, or formating a new date from the calculation. I am trying to get "countdown" information I guess you could call it, that says "x days, y hours, z minutes until TIMESTAMP.
If I have missed something obvious, my apologies, but any help would be greatly appreciated.
June 14th, 2000, 04:29 PM
The best idea I could come up with is to convert to a unix timestamp to get a difference in seconds. You would have to convert to ddhhmmss format from that.
select unix_timestamp(date_field)-unix_timestamp() as sec_diff from table;
June 16th, 2000, 12:01 PM
Okay, that is something that I had considered but what is the best way to do the conversion to d:m:h:s afterwards?
June 16th, 2000, 12:32 PM