var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: storing time
how can i store time in my table
1 hr:55 mins:22 secs
This is my tot requirement.
I have two columns with time data types.
First column is is target_time and secong column is the time_reached
target_time time reached delay
3:23:12 4:13:12 1:40:00
2:23:23 3:42:24 1:19:01
(h:mi:ss) (h:mi:ss) (h:mi:ss)
formual is : (time_reached-target_time)=delay
Create a table something like:
Beware, you are only storing time values. This will cause havok if you ever roll past midnight!
CREATE TABLE foo (
target_time DATETIME NULL
, time_reached DATETIME NULL
INSERT INTO foo
SELECT '3:23:12', '4:13:12'
, UNION ALL SELECT '2:23:23', '3:42:24'
SELECT target_time, time_reached
, DateAdd(seconds, DateDiff(seconds, time_reached, target_time)
, '0:00') AS delay
Cry havoc and let slip the databases of war!
I have to wonder why you only want to store time values, and not the date portion.
Sounds like it may be marathon run times, or something. Anyway, it would be an interesting application of datetime.