Read two dates in my .txt file

I need to store two dates that appear in my .txt file and check if they are the same or different to include a condition

For example:

image

I need to check if these two dates marked in yellow are the same or not

HI @lourena.coutinho

To convert string date (dd-MM-yyyy) in DateTime format just use the following code in the Assign activity.

Date1 = DateTime.ParseExact(StrDate, “dd-MM-yyyy”,System.Globalization.CultureInfo.InvariantCulture)

Here, in code you can see that, there’s a variable StrDate (type String) holding your string date.
Date1 is of type DateTime

So as you have var Date1 (DateTime) holding specified date.
You can compare as you want it with today’s date in If activity with condition

—> Date1 > DateTime.Today

Hi, but I need to read the dates in my text file not convert

@lourena.coutinho

Could you share the sample Text file

@lourena.coutinho

Here is the workflow
Compare Date.xaml (6.5 KB)

Hope this will work for you

Let me know if you face any issue

Regards
Gokul

1 Like

In these two initial assignment activities, can I put a text reading activity? and I replace in the expression REG the variables by the variable of this text reading activity, correct?

@lourena.coutinho

Yes, You can use Read text File Activity

1 Like

The first date (Regex Dt1) appears correctly, the second (Regex dt2) appears empty and not the date. And the only thing I changed was the variable, in both expressions.

I Change the expression in the second variable and Know works. Thanks for your help

@Gokul001 , I have seen your workflow. Can you explain why you use “(?<=PERIODO:\s)” this \s, while in case of “Regex_Dt1” you don’t use \s “?<=EMISSAO:” .

Regards,
Nirmalya Sarkar.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.