1

I want the date difference between to dates dipslayed in days and also minutes. The problem is that the function:

${datediff(datetime_1, datetime_2, "DAY")}

will obviously only give me the difference in days back. Putting after the "DAY" for example a && "MINUTE" will not work.

Is there a solution to this question or any workaround ?

OlWi21
  • 33
  • 6

1 Answers1

1

Datediff with parameter "minute" would give you minutes and since every 1440(24hour*60minutes/hour) minute is a day you can divide by 1440 to get the day, modulo by 1440 to get remainder "minutes"

Onur Dilek
  • 59
  • 5
  • Thanks for the fast anwser first of all. But what do you mean with "mod by 1440 to get remainder "minutes"". ? In detail I mean the mod by 1440. – OlWi21 Dec 10 '21 at 08:41
  • like 5%2=1 so "mod" operation gives the remainder of a division. You can check here : https://stackoverflow.com/questions/17524673/understanding-the-modulus-operator – Onur Dilek Dec 10 '21 at 12:08
  • 1
    Ah okay you mean modulo. Now I get it. Thank you – OlWi21 Dec 10 '21 at 13:20
  • Yeah sorry, haven't called it modulo since university. Will edit the response for future reference. – Onur Dilek Dec 14 '21 at 13:32
  • Just for completeness: ${datediff(datetime_1, datetime_2, "MINUTE")} see https://apps.synesty.com/transformy/en-us?action=showTemplateFunctionDocumentation&target=snippets#datediff – Christoph Dec 27 '21 at 21:05