Trouble using DATEDIFF

[expired user #3338]'s profile image [expired user #3338] posted 16 years ago in General Permalink
Hi everybodyhappy,
i just start using SQL and i have a trouble using DATEDIFF in HeidiSQL. i have one date '2007-12-27' and i trying to obtain how many months and days are of difference between that date and Today(CURRENT_DATE()) i
ansgar's profile image ansgar posted 16 years ago Permalink
You could divide the result of DATEDIFF by 30, that would give you a rough result. But I guess you want the exact months and days, as different months have a different number of days. That should be done with some application logic, not SQL.
[expired user #1821]'s profile image [expired user #1821] posted 16 years ago Permalink
with the command TO_DAYS you can convert the date to an amount of days and substract one from the other in that way, so the result will also be in days

Please login to leave a reply, or register at first.