date difference

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

date difference

Post by itsmani1 »

Hi all

I want to calculate date difference between two times, i have a time like ('2008-07-28 23:59:59') and then interval in days like 7 days

I want to add time + interval in days and then want to find difference with the current time.


any idea....

thank you
dizyn
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: date difference

Post by EverLearning »

I guess you're talking about MySql based on the date format. Use

Code: Select all

SELECT DATE_ADD('2008-07-28 23:59:59', INTERVAL 7 DAY);
For more information look up MySql Date and Time Functions
Post Reply