Connecting Tech Pros Worldwide Help | Site Map

DATEDIFF in Mysql 4.0

Newbie
 
Join Date: Jun 2007
Posts: 4
#1: Aug 28 '07
Dear All,

The following query is not working in Mysql 4.0
Expand|Select|Wrap|Line Numbers
  1. SELECT DATEDIFF(
  2. '2007-08-27', '2007-08-17'
But this query is working in MySQL 4.1.15.

What should i do to find the date difference in Mysql 4.0 But the date format query is working
ie
Expand|Select|Wrap|Line Numbers
  1. SELECT DATE_FORMAT(Dt,'%d-%m-%Y') FROM Product_Master
.

Kindly provide the solution.

Thanks in advance.

Best Regards,
Madhumadhi.S
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 718
#2: Aug 28 '07

re: DATEDIFF in Mysql 4.0


Kindly use appropriate CODE tags when posting code.


Use can use TO_DAYS(). It returns a day number (the number of days since year 0).
Expand|Select|Wrap|Line Numbers
  1. SELECT TO_DAYS('2007-08-27') - TO_DAYS('2007-08-17')
Newbie
 
Join Date: Jun 2007
Posts: 4
#3: Aug 31 '07

re: DATEDIFF in Mysql 4.0


Hi,

Thanks a lot.
It's working fine

Best Regards,
Madhumadhi.S
Reply