var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help with date functions
Hi every one
I need help with the date function
I want to subtract two dates with type DATETIME to know how much time user spent.
will really appriciate it
select TO_DAYS(date1) - TO_DAYS(date2)
but that will give me no. of days not time I'm using datetime as type
select UNIX_TIMESTAMP(datetime1) - UNIX_TIMESTAMP(datetime2)
this will give you the difference in seconds
if the difference is less than 24 hours, you can then use SEC_TO_TIME to convert the result back to hh:mm:ss format
if it's more than 24 hours, you have to do additional arithmetic
Last edited by r937; 06-11-04 at 09:21.
Thanks man really appriciate it.