# Convert format date?

**URL:** <https://forum.uipath.com/t/convert-format-date/308518>\
**Category:** Activities\
**Tags:** question, excel, system, activities\
**Created:** [April 19, 2021, 6:21am UTC](https://forum.uipath.com/t/convert-format-date/308518 "2021-04-19T06:21:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [April 19, 2021, 6:21am UTC](https://forum.uipath.com/t/convert-format-date/308518/1 "2021-04-19T06:21:55Z")

</div>

I have variable dateInput = 31/12/2020

I want to check each row from excel (column A) equal dateInput or not.  
but CurrentRow format 12/31/2020 00:00:00

How to change format in currentRow?

Guide me about it please.

 ![image](https://global.discourse-cdn.com/uipath/original/3X/8/8/882f76da75deab72f2fdb3d6930a73d3ba2b8167.png)

---

<div class="post-metadata">

**Author:** ![prasath\_S](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath_s/32/290219_2.png) [@prasath\_S](https://forum.uipath.com/u/prasath_S)\
**Post date:** [April 19, 2021, 6:32am UTC](https://forum.uipath.com/t/convert-format-date/308518/2 "2021-04-19T06:32:32Z")

</div>

Hi @fairymemay

Please try this

DateTime.ParseExact(currentrow(0). tostring,“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)

---

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [April 19, 2021, 6:44am UTC](https://forum.uipath.com/t/convert-format-date/308518/3 "2021-04-19T06:44:04Z")

</div>

@prasath_S Now I use below.

DateTime.ParseExact(currentrow(0). tostring,“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”).Equals(dateInput)

It show error.

![image](https://global.discourse-cdn.com/uipath/original/3X/9/3/93450731285aedfb8e06de7441773c2ea29a0808.png)

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

---

<div class="post-metadata">

**Author:** ![prasath\_S](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath_s/32/290219_2.png) [@prasath\_S](https://forum.uipath.com/u/prasath_S)\
**Post date:** [April 19, 2021, 6:44am UTC](https://forum.uipath.com/t/convert-format-date/308518/4 "2021-04-19T06:44:44Z")

</div>

Is dateInput a datetime variable

If it is datetime variable

Convert.todatetime(DateTime.ParseExact(currentrow(0). tostring,“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)).Equals(dateInput)

---

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [April 19, 2021, 6:53am UTC](https://forum.uipath.com/t/convert-format-date/308518/5 "2021-04-19T06:53:13Z")

</div>

@prasath_S dateInput a string variable.

---

<div class="post-metadata">

**Author:** ![prasath\_S](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath_s/32/290219_2.png) [@prasath\_S](https://forum.uipath.com/u/prasath_S)\
**Post date:** [April 19, 2021, 6:55am UTC](https://forum.uipath.com/t/convert-format-date/308518/6 "2021-04-19T06:55:26Z")

</div>

Convert.todatetime(DateTime.ParseExact(currentrow(0). tostring,“dd/MM/yyyy”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)).Equals(Convert.todatetime(dateInput))

try this and show what value is stored in dateInput variable

---

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [April 19, 2021, 7:02am UTC](https://forum.uipath.com/t/convert-format-date/308518/7 "2021-04-19T07:02:59Z")

</div>

@prasath_S same error.

![image](https://global.discourse-cdn.com/uipath/original/3X/f/d/fd49814db37db229cbd83102852b3d6ad66f3d32.png)

---

<div class="post-metadata">

**Author:** ![prasath\_S](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/prasath_s/32/290219_2.png) [@prasath\_S](https://forum.uipath.com/u/prasath_S)\
**Post date:** [April 19, 2021, 7:03am UTC](https://forum.uipath.com/t/convert-format-date/308518/8 "2021-04-19T07:03:58Z")

</div>

and what is value of currentrow(0).tostring

---

<div class="post-metadata">

**Author:** ![fairymemay](https://avatars.discourse-cdn.com/v4/letter/f/ecd19e/32.png) [@fairymemay](https://forum.uipath.com/u/fairymemay)\
**Post date:** [April 19, 2021, 7:30am UTC](https://forum.uipath.com/t/convert-format-date/308518/10 "2021-04-19T07:30:42Z")

</div>

@prasath_S Value currentrow(0).tostring as below.

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

 ![image](https://global.discourse-cdn.com/uipath/original/3X/f/1/f1078b250b5f36afcf78f743511c962e81e86650.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:** [April 19, 2021, 8:15am UTC](https://forum.uipath.com/t/convert-format-date/308518/11 "2021-04-19T08:15:52Z")

</div>

Hi @fairymemay  
in read range check the preserve format option  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/5/1/5156c87611062dc788c3e87517b8edef3d1ba091.png)  
then use below if condition : **CurrentRow(0).ToString.Equals(dateInput)**

**OR another way is**

to use below condition in if activity  
**DateTime.ParseExact(currentrow(0). tostring,“dd/MM/yyyy HH:mm:ss”,Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”).Equals(dateInput)**

Try any way as mentioned above

Regards,  
Nived N  
Happy Automation

---

<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:** [April 22, 2021, 8:16am UTC](https://forum.uipath.com/t/convert-format-date/308518/12 "2021-04-22T08:16:16Z")

</div>

Closed on April 22, 2021, 8:16am UTC

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