IF(DATETIME_DIFF(NOW(), Date, 'y') > 0,
CONCATENATE("over ", DATETIME_DIFF(NOW(), Date, 'y'), " year", IF(DATETIME_DIFF(NOW(), Date, 'y') = 1, "", "s"), " ago"),
IF(DATETIME_DIFF(NOW(), Date, 'M') > 0,
CONCATENATE("over ", DATETIME_DIFF(NOW(), Date, 'M'), " month", IF(DATETIME_DIFF(NOW(), Date, 'M') = 1, "", "s"), " ago"),
IF(DATETIME_DIFF(NOW(), Date, 'w') > 0,
CONCATENATE("over ", DATETIME_DIFF(NOW(), Date, 'w'), " week", IF(DATETIME_DIFF(NOW(), Date, 'w') = 1, "", "s"), " ago"),
IF(DATETIME_DIFF(NOW(), Date, 'd') > 0,
CONCATENATE("over ", DATETIME_DIFF(NOW(), Date, 'd'), " day", IF(DATETIME_DIFF(NOW(), Date, 'd') = 1, "", "s"), " ago"),
IF(DATETIME_DIFF(NOW(), Date, 'h') > 0,
CONCATENATE("over ", DATETIME_DIFF(NOW(), Date, 'h'), " hour", IF(DATETIME_DIFF(NOW(), Date, 'h') = 1, "", "s"), " ago"),
IF(DATETIME_DIFF(NOW(), Date, 'm') > 0,
CONCATENATE("over ", DATETIME_DIFF(NOW(), Date, 'm'), " minute", IF(DATETIME_DIFF(NOW(), Date, 'm') = 1, "", "s"), " ago"),
"less than a minute ago"
)
)
)
)
)
)
I can not take the credit for this. ChatGPT came to my aid. I pasted it in and said "Can you change the datetime_diff statement so that if minute > 1 it shows minutes, and if minute = 1 it shows minute" and it did this in less than a second.
Unbelievable; I need a sit down now