Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.
alteryx Community

# Alteryx Designer Desktop Discussions

## number of days between two dates

8 - Asteroid

Dear All,

how can i get the number of days between these two dates, only taking 2019 period like for

01/01/2019 and 31/12/2021- i need to calculate number of days between 01/01/2019 to 31/12/2019 and for

01/08/2015 and 31/03/2019-i need to calculate number of days between 01/01/2019 to 31/03/2019 and for

01/06/2019 and 31/05/2022 -i need to calculate number of days between 01/06/2019 to 31/12/2019 and for

01/11/2019 and 31/10/22 -i need to calculate number of days between 01/11/2019 to 31/12/2019 and for

 01/01/2019 31/12/2021 01/08/2015 31/03/2019 01/06/2019 31/05/2022 01/11/2019 31/10/2022

Thank you so much in advance

9 REPLIES 9
21 - Polaris

@Ekta
Something like this?

16 - Nebula

Hi @Ekta ,

first step is to convert the dates to the Alteryx Date data type using a DateTimeParse function for both columns (called them "Start" and "End")
DateTimeParse([Start],'%d/%m/%Y')
DateTimeParse([End],'%d/%m/%Y')

The Data Type should be "Date" for both new columns, call them e.g. "StartDate" and "EndDate"

In a second step, you can dcalculate the difference using DateTimeDiff function:
DateTimeDiff([EndDate], [StartDate], 'days').

I've attached a sample workflow. Let me know if it works for you.

Best,

Roland

8 - Asteroid

Thanks a lot for the quick reply, but i am struggling with the year of the dates.i want to keep the period to only 2019 while using the datetime diff 😞

Thank you

8 - Asteroid

Thanks a lot for the quick reply, but i am struggling with the year of the dates.i want to keep the period to only 2019 while using the datetime diff 😞

Thank you

16 - Nebula

I think, an additional condition could solve the problem. Check, if "EndDate" is in 2019, else replace it by the last day of 2019.

I've modified the workflow a bit. What do you think?

21 - Polaris

Sorry. Made the same mistake with @RolandSchubert

17 - Castor

Hi @Ekta , give this a try as well.

If it works then kindly mark this post as solution.

Thanks.

Sapna Gupta
7 - Meteor

I am struggling get the days difference from 2 different dates to work, I am looking for the difference between Quarter Date - Creation Date, can someone take a look at this?

8 - Asteroid

b

Labels