Date difference in MySQL Oct25 '04
Here’s a handy reference that uses MySQL to find the number of days between two dates.
This is useful for job applications, where they ask you how many days you’ve worked at a particular place. What I do is keep a "Job Info" text file on my computer with all this information already computed. Then, when I go to fill out an application, I print the info and take it with me.
Bam. Done.
From the MySQL standpoint, this is obviously a popular thing to do, because as of version 4.1.1, there are explicit functions that do just that. But, as of this date, version 4.1.1 is not the release build, so I will mention another way to do it.
(As far as I know, 4.0.2 is the most stable release build.)
Prior to MySQL 4.1.1:
SELECT TO_DAYS('2004-11-08') - TO_DAYS('2004-07-26');
–> 105
As of MySQL 4.1.1:
SELECT DATEDIFF('2004-11-08','2004-07-26');
–> 105
The dates I used are just examples. Obviously, you can insert any dates in there, as long as the most recent date is listed first.
Categories: SQL ![]()
Add Feedback (view all)
Leave feedback
Well, Thanks to the site . I never knew what is the replacement of the dual of ORACLE in MySQL to test the in built functions of MySql Well ... Read more.
Popular Pages
- Fast rounded corners in Photoshop (7424 recent visits)
- PHP – passing variables across pages (2558 recent visits)
- JavaScript set selected on load (2414 recent visits)
- Removing all child nodes from an element (1828 recent visits)
- Firefox 3 smart address bar: wildcard search (1755 recent visits)
- iPod songs out of order? (1314 recent visits)
- Britney - Everytime piano tab (1138 recent visits)
- MySQL LEFT JOIN syntax (884 recent visits)
- Firefox 3 smart address bar: wildcard search (722 recent visits)
- Date difference in MySQL (651 recent visits)
Similar Entries
- Install Apache, PHP, MySQL on Windows (25 recent visits)
- MySQL search criteria - column alias (225 recent visits)
- MySQL integer columns and display width (250 recent visits)
- MySQL LEFT JOIN syntax (884 recent visits)
- MySQL viewing saved searches (12 recent visits)
- MySQL changing column types (119 recent visits)
Stats
651 unique visits since July 2008
Recent Referrers (click)
- http://commentcamarche.net/for
- mysql date differences
- date difference in mysql
- day diff mysql
- date difference mysql
- mysql date difference
- mysql date differences
- mysql dates difference
- mysql date difference
- mysql date differences
- mysql date diffrence
- mysql datediff
- example date_diff in mysql
- http://commentcamarche.net/for
- MySQL DATE difference
- finding days difference in dates using mysql
- datediff in mysql
- diiference mysql
- difference function mysql
I found solution using this query. This site is very easy understand things. This is very userfriendly. I just added this site to my favourites. ... Read more.