Substratc date strings

Hi! I have variable A and B with the same format = Datetime.parseexact(row(0).ToString,“yyyyMMdd”,system.globalization.cultureinfo.invariantculture).tostring(“dd-MM-yyyy”)

How can i substract? i receive error message like “substract its not member of sting”…i try some possibilites but without sucess

another error:

tanks

@Pedro_Santos - You can try the below…

DateDiff(dateinterval.Day,Convert.todatetime(row(“A”)),Convert.todatetime(row(“B”)))

Many tanks!

But…still an error… can you help?

Hi @Pedro_Santos

Please check the two things

  1. use write line activity to check how date is outputted using row(0).ToString in writeline
    and then change format accordingly
    or

check the preserve format in read range so to preserve the date format in excel

Hi

Tanks but… if you can help… this is the output

is it the format of row(0).ToString @Pedro_Santos

@NIVED_NAMBIAR

Yellow is row(0)
Blue date from a app

Both of them i use Datetime.parseexact(str yellow and blue,“dd-MM-yyyy”,system.globalization.cultureinfo.invariantculture).tostring(“dd-MM-yyyy”)

to have the same convertion and sequence.

Can i do another way?

image

@Pedro_Santos - Please find the attached workflow…DateDiff.zip (42.2 KB)

Hope this helps…

@Pedro_Santos - Did you get a chance to try the provided workflow?

If yes and it worked, please mark my post as solution , that will close this thread.

Check this below code, @Pedro_Santos
(Date.ParseExact(Date.ParseExact(“20211212”,“yyyyMMdd”,System.Globalization.Cultureinfo.Invariantculture).ToString(“dd-MM-yyyy”),“dd-MM-yyyy”,System.Globalization.Cultureinfo.Invariantculture) - Date.ParseExact(Date.ParseExact(“20211128”,“yyyyMMdd”,System.Globalization.Cultureinfo.Invariantculture).ToString(“dd-MM-yyyy”),“dd-MM-yyyy”,System.Globalization.Cultureinfo.Invariantculture)).TotalDays
Hope this may help you :slight_smile:

1 Like

@Pedro_Santos

Check below for your reference

Hope this helps you

Thanks

1 Like

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