Identify gaps between two dates?

I need to be able to identify any gaps between dates, for example:

Start Date - End Date
01/01/2015 - 31/12/2015
01/01/2017 - 31/12/2017
01/01/2018 - 31/12/2018

I need my bot to be able to identify the gap above (for 2016) and return the date range of 01/01/2016 - 31/12/2016 as two string variables.

How can I do this? Thanks in advance!

You need difference in days or in date format ?


@Jon_G Is the StartDate and EndDate range always 1 year ?

Date format. The new Start/End dates are then applied to some data enrichment for an output file.

It should be 1 year always I believe, but I need to design it to be dynamic and accept anything I think. It’s a tricky one! The idea is to enrich some data load files which need to load records into a database and ensure a specific date range is covered.

@Jon_G Is the Data in an Excel File?

For example. I would be supplied a raw file with date range “01/01/2015 - 01/01/2018” and it would need to look at the above selection of dates and identify that there was a period of time (eg. in 2016) without coverage, and use that date range for the new record to be loaded.

Data is supplied in CSV file which I have UiPath reading into datatable

@Jon_G The Raw file with Data Range, will it be a Text Format ?

Yes text file, I can import as Data Table so I use Data Table column/row references.

@Jon_G Can you Try this workflow : (8.3 KB)

I have used a Sample Excel and Sample Raw File, and I have Skipped 2016 and 2019.

The Workflow does Output Both the years inside a For Each Loop. Don’t exactly know if this is the requirement you need but it might give you an Idea.

1 Like