distal-attribute
distal-attribute
distal-attribute
distal-attribute

Trouble using DATEDIFF

geragera posted 7 years ago in General
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 posted 7 years ago
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.
siMKin posted 7 years ago
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.