TIMESTAMP(14) :
Expiration is 20040814000751
NOW() is 20040815120624
NOW()-Expiration is giving 1119873 which is mathematically correct. But only one day has passed and 1119873/(60*60*24) gives 12.96.
Where am I going wrong ? The query part or the math part ?
Difference in TIMESTAMP VALUES
Moderator: General Moderators
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
TIMESTAMPS are not stored in seconds.
You maybe interested in some of these functions:
Date and Time Functions
Perticularly FROM_UNIXTIME(unix_timestamp) and UNIX_TIMESTAMP(date) these two will help convert to/from Unix time and MySQL time formats.
You maybe interested in some of these functions:
Date and Time Functions
Perticularly FROM_UNIXTIME(unix_timestamp) and UNIX_TIMESTAMP(date) these two will help convert to/from Unix time and MySQL time formats.
Last edited by Buddha443556 on Sun Aug 15, 2004 9:46 am, edited 2 times in total.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Try:
That should give you the seconds you want.
Code: Select all
UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(Expiration)