# Date and excel

**URL:** <https://forum.uipath.com/t/date-and-excel/63993>\
**Category:** Help\
**Tags:** activities, excel\
**Created:** [September 7, 2018, 8:06am UTC](https://forum.uipath.com/t/date-and-excel/63993 "2018-09-07T08:06:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![qaz1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qaz1/32/263941_2.png) [@qaz1](https://forum.uipath.com/u/qaz1)\
**Post date:** [September 7, 2018, 8:06am UTC](https://forum.uipath.com/t/date-and-excel/63993/1 "2018-09-07T08:06:37Z")

</div>

I have extracted the date from excel and the format is “MM/dd/yyyy”

so i used  
Date.ParseExact(“MM/dd/yyyy”,row(“Project Date”).ToString, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)  
to change the format to “dd/MM/yyyy”

I still face error after typing this into the message box…

Main has thrown an exception

Message: String was not recognized as a valid DateTime.

---

<div class="post-metadata">

**Author:** ![Tiberiu\_Niculescu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tiberiu_niculescu/32/177057_2.png) [@Tiberiu\_Niculescu](https://forum.uipath.com/u/Tiberiu_Niculescu)\
**Post date:** [September 7, 2018, 8:16am UTC](https://forum.uipath.com/t/date-and-excel/63993/2 "2018-09-07T08:16:13Z")

</div>

your method is date.parseExact(format, String, culture)

it should be: date.parseExact(String, format, culture)

---

<div class="post-metadata">

**Author:** ![Manjuts90](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manjuts90/32/176617_2.png) [@Manjuts90](https://forum.uipath.com/u/Manjuts90)\
**Post date:** [September 7, 2018, 9:57am UTC](https://forum.uipath.com/t/date-and-excel/63993/3 "2018-09-07T09:57:21Z")

</div>

@qaz1 try below one

Date.ParseExact(row(“Project Date”).ToString,“MM/dd/yyyy”,Nothing).ToString(“dd/MM/yyyy”)

---

<div class="post-metadata">

**Author:** ![sangasangasanga](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sangasangasanga/32/66848_2.png) [@sangasangasanga](https://forum.uipath.com/u/sangasangasanga)\
**Post date:** [November 7, 2018, 9:40am UTC](https://forum.uipath.com/t/date-and-excel/63993/4 "2018-11-07T09:40:17Z")

</div>

> [@Manjuts90](#):
>
> Date.ParseExact(row(“Project Date”).ToString,“MM/dd/yyyy”,Nothing).ToString(“dd/MM/yyyy”)

Hi @Manjuts90, How can I change ‘03 Sep 2018’ to 9/03/2018?  
It isn’t working  
Date.ParseExact(dateu,“dd/MMM/yyyy”,Nothing).ToString(“M/dd/yyyy”)

---

<div class="post-metadata">

**Author:** ![Manjuts90](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manjuts90/32/176617_2.png) [@Manjuts90](https://forum.uipath.com/u/Manjuts90)\
**Post date:** [November 7, 2018, 11:37am UTC](https://forum.uipath.com/t/date-and-excel/63993/5 "2018-11-07T11:37:15Z")

</div>

@sangasangasanga Instead of dd/MMM/yyyy give dd MMM yyyy

Try once like above.

---

<div class="post-metadata">

**Author:** ![sangasangasanga](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sangasangasanga/32/66848_2.png) [@sangasangasanga](https://forum.uipath.com/u/sangasangasanga)\
**Post date:** [November 8, 2018, 3:53am UTC](https://forum.uipath.com/t/date-and-excel/63993/6 "2018-11-08T03:53:32Z")

</div>

Hi @Manjuts90 , I tried like you suggested.  
Date.ParseExact(dateu,“dd MMM yyyy”,Nothing).ToString(“M/dd/yyyy”)  
But still got error. String was not recognized as a valid datetime

---

<div class="post-metadata">

**Author:** ![Manjuts90](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manjuts90/32/176617_2.png) [@Manjuts90](https://forum.uipath.com/u/Manjuts90)\
**Post date:** [November 8, 2018, 4:08am UTC](https://forum.uipath.com/t/date-and-excel/63993/7 "2018-11-08T04:08:50Z")

</div>

@sangasangasanga

> [@sangasangasanga](#):
>
> 03 Sep 2018

I just tried above date with below statement, it is working fine, where dateu i am declared as string.

> [@sangasangasanga](#):
>
> Date.ParseExact(dateu,“dd/MMM/yyyy”,Nothing).ToString(“M/dd/yyyy”)

Please check once what value dateu variable contains

---

<div class="post-metadata">

**Author:** ![Vivek\_Arunagiri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vivek_arunagiri/32/558580_2.png) [@Vivek\_Arunagiri](https://forum.uipath.com/u/Vivek_Arunagiri)\
**Post date:** [November 8, 2018, 4:47am UTC](https://forum.uipath.com/t/date-and-excel/63993/8 "2018-11-08T04:47:25Z")

</div>

> [@qaz1](#):
>
> row(“Project Date”).ToString

Hi @qaz1, Try using the below one.

Convert.ToDateTime(row(“Project Date”).ToString).ToString(“dd/MM/yyyy”)

---

<div class="post-metadata">

**Author:** ![sangasangasanga](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sangasangasanga/32/66848_2.png) [@sangasangasanga](https://forum.uipath.com/u/sangasangasanga)\
**Post date:** [November 8, 2018, 6:07am UTC](https://forum.uipath.com/t/date-and-excel/63993/9 "2018-11-08T06:07:56Z")

</div>

@Manjuts90 Weird, it is not working for me…  
dateu = Date.ParseExact(dateu,“dd MMM yyyy”,Nothing).ToString(“M/dd/yyyy”)  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/4/c/4c0b1e600bf639dc57b8c2eaf192925fb841b152.png)

Is it because I add 2018 to it?  
dateu + " 2018"  
Then, I assigned the code

---

<div class="post-metadata">

**Author:** ![Manjuts90](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/manjuts90/32/176617_2.png) [@Manjuts90](https://forum.uipath.com/u/Manjuts90)\
**Post date:** [November 8, 2018, 6:13am UTC](https://forum.uipath.com/t/date-and-excel/63993/10 "2018-11-08T06:13:31Z")

</div>

@sangasangasanga Don’t know what exactly problem with that. Try something like below.

Convert.ToDateTime(dateu).ToString(“dd/MM/yyyy”)

Try also Prase method and other methods u already know.

---

<div class="post-metadata">

**Author:** ![sangasangasanga](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sangasangasanga/32/66848_2.png) [@sangasangasanga](https://forum.uipath.com/u/sangasangasanga)\
**Post date:** [November 8, 2018, 6:17am UTC](https://forum.uipath.com/t/date-and-excel/63993/11 "2018-11-08T06:17:45Z")

</div>

It works now… Thank you 🙂
