You C logic is fine, but I don't know it your date_time field contains a unix timestamp as my 'timestamp' field does.
I'm using a unix timestamp because it's easy to play with that in C then. If you're using a mysql datetime type field, u'll probably need to find the function that returns the unix timestamp in the sql line...
select datetimetounix(date_time) from pretimes...
or something similar... I don't know the exact function name, but I think it exist.
|