Gossamer Forum
Home : General : Databases and SQL :

Mysql date calculation

Quote Reply
Mysql date calculation
I am trying some logic to calcutale a time difference between a 'lastmailsent' and 'newmail sent'. I have set the time field to TIMSTAMP data types. I need to calculate the time difference in seconds.
Can any one help me out with this.
thnx
Quote Reply
Re: [nuwandee] Mysql date calculation In reply to
it'd probably be easier let Perl handle the timestamp field rather than mySQL, since none of the date/time column types record in seconds only.

if you use the Perl function time() as your data, you will get time since epoch (which is in seconds), them you can simply subtract your timestamp for "lastmailsent" from "newmailsent" to get want you need.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [nuwandee] Mysql date calculation In reply to
This should help: http://www.mysql.com/..._time_functions.html

Cheers,

Alex
--
Gossamer Threads Inc.