Page 1 of 1

Calculate Days months Years between two dates

Posted: Fri Mar 05, 2021 3:37 pm
by omkar.patange
calculate Days months between two dates.
For Eg: Start Hiring Date: 1 Jan 2020 To Today (5 March 2021)
What expression should I Use to get a result? I need an expression for Years/Months and Days.

1 year, 2 months, 4 days

I can use separate columns (expression) for each Year, Months, and Days.

I have already followed precious expressions: 1. (Startdate-Today).TotalDays 2. DateDiff(Startdate,today).Days

Not getting Correct result. Please Help!

Re: Calculate Days months Years between two dates

Posted: Tue Mar 09, 2021 2:54 pm
by Lech Kulikowski
Hello,

You can use the following expression:
{(DateTime2 - DateTime1).Days}

And then calculate years, months, and days separately as you need.

Thanky ou.

Re: Calculate Days months Years between two dates

Posted: Tue Feb 07, 2023 1:16 pm
by bojef
Hello all. I’ve been searching for a solution to get the difference between two dates in years, months and days like 10th of April 2021 was 2 years, 2 months and 11 days ago, or 12th of Juli 2023 was 0 years, 2 months and 12 days ago. (in reference to current date 24/9/21).

I know how to get the amount of years incontagem ferias, this should be done by calanderYearsBetween(Date1, CurrentDate), the amount of monts should be something like calanderMonths(Date1, CurrentDate) – (12 * amountOfYears). But I can’t think of something to get the amount of days.

Is there any option to calcualte something like this, it needs to be exact...

Re: Calculate Days months Years between two dates

Posted: Thu Feb 09, 2023 8:38 am
by Lech Kulikowski
Hello,

Please try to check the following solution:
https://stackoverflow.com/questions/382 ... in-c-sharp

Thank you.