# Substratc date strings

**URL:** <https://forum.uipath.com/t/substratc-date-strings/295028>\
**Category:** Activities\
**Tags:** question, system, activities\
**Created:** [March 2, 2021, 4:50pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028 "2021-03-02T16:50:53Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedro\_Santos](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pedro_santos/32/156087_2.png) [@Pedro\_Santos](https://forum.uipath.com/u/Pedro_Santos)\
**Post date:** [March 2, 2021, 4:50pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/1 "2021-03-02T16:50:53Z")

</div>

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:

 ![image](https://global.discourse-cdn.com/uipath/original/3X/2/a/2abc96377d1ac976bc309324aca65c871b908f52.png)

tanks

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [March 2, 2021, 4:59pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/2 "2021-03-02T16:59:43Z")

</div>

@Pedro_Santos - You can try the below…

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

---

<div class="post-metadata">

**Author:** ![Pedro\_Santos](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pedro_santos/32/156087_2.png) [@Pedro\_Santos](https://forum.uipath.com/u/Pedro_Santos)\
**Post date:** [March 2, 2021, 5:15pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/3 "2021-03-02T17:15:10Z")

</div>

Many tanks!

But…still an error… can you help?

 ![image](https://global.discourse-cdn.com/uipath/original/3X/c/4/c43965d4a50d1041b3bc7181b331f94a4700d5df.png)

---

<div class="post-metadata">

**Author:** ![NIVED\_NAMBIAR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nived_nambiar/32/169066_2.png) [@NIVED\_NAMBIAR](https://forum.uipath.com/u/NIVED_NAMBIAR)\
**Post date:** [March 2, 2021, 5:18pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/4 "2021-03-02T17:18:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pedro\_Santos](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pedro_santos/32/156087_2.png) [@Pedro\_Santos](https://forum.uipath.com/u/Pedro_Santos)\
**Post date:** [March 2, 2021, 5:23pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/5 "2021-03-02T17:23:46Z")

</div>

Hi

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

![image](https://global.discourse-cdn.com/uipath/original/3X/b/e/bec688480648bb1ddf05ab95e6814ac8912e5509.png)

---

<div class="post-metadata">

**Author:** ![NIVED\_NAMBIAR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nived_nambiar/32/169066_2.png) [@NIVED\_NAMBIAR](https://forum.uipath.com/u/NIVED_NAMBIAR)\
**Post date:** [March 2, 2021, 5:48pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/6 "2021-03-02T17:48:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pedro\_Santos](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pedro_santos/32/156087_2.png) [@Pedro\_Santos](https://forum.uipath.com/u/Pedro_Santos)\
**Post date:** [March 2, 2021, 6:01pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/7 "2021-03-02T18:01:20Z")

</div>

@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](https://global.discourse-cdn.com/uipath/original/3X/f/5/f5fd2cd823ae0253b38c34a7f22a6ef79fb97ac8.png)

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [March 2, 2021, 6:06pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/8 "2021-03-02T18:06:16Z")

</div>

@Pedro_Santos - Please find the attached workflow…[DateDiff.zip](https://forum.uipath.com/uploads/short-url/3zzeKKimKwrEYKsr0WaIXoruxQR.zip) (42.2 KB)

Hope this helps…

---

<div class="post-metadata">

**Author:** ![prasath17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath17/32/182331_2.png) [@prasath17](https://forum.uipath.com/u/prasath17)\
**Post date:** [March 6, 2021, 10:51pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/9 "2021-03-06T22:51:01Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Manish540](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manish540/32/356167_2.png) [@Manish540](https://forum.uipath.com/u/Manish540)\
**Post date:** [March 7, 2021, 5:26am UTC](https://forum.uipath.com/t/substratc-date-strings/295028/10 "2021-03-07T05:26:07Z")

</div>

> [@Pedro\_Santos](#):
>
> Datetime.parseexact(row(0).ToString,“yyyyMMdd”,system.globalization.cultureinfo.invariantculture).tostring(“dd-MM-yyyy”)

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 🙂

---

<div class="post-metadata">

**Author:** ![Srini84](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/srini84/32/464032_2.png) [@Srini84](https://forum.uipath.com/u/Srini84)\
**Post date:** [March 7, 2021, 5:35am UTC](https://forum.uipath.com/t/substratc-date-strings/295028/11 "2021-03-07T05:35:56Z")

</div>

@Pedro_Santos

Check below for your reference

[![](https://global.discourse-cdn.com/uipath/original/4X/9/5/7/95759c5a412f48b6e6a027ce452872f1834a5ccc.jpeg "How to Convert Date and Time Format using UiPath || RPA UseCase") ](https://www.youtube.com/watch?v=h9pAsRS6hmc)

Hope this helps you

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [March 15, 2021, 2:21pm UTC](https://forum.uipath.com/t/substratc-date-strings/295028/12 "2021-03-15T14:21:13Z")

</div>

Closed on March 15, 2021, 2:21pm UTC

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