How to convert string to dd-mmm-yyyy

Dear Members,

I have got date in an excel column in the format - 17 July 2019 . I want to read it in uipath and convert it into a date data type of dd-mmm-yyyy.

Could you please let me know the easiest way to do the same ?

Regards
Minal Gupta

@MinalGupta

Try this:

DateTime dateParsed = DateTime.ParseExact(row(“DateColumn”).Tostring, “dd-MMMM-yyyy”, System.Globalization.CultureInfo.InvariantCulture)

1 Like

@MinalGupta

You can create a variable type with date and the string which you read from excel can be convert like this

Datevar=cdate(datestr)

Thanks
Aman

Hi @MinalGupta

Assign strvar=row(“column name”). ToString

Use assign strvar2=cdate(strvar)

Thanks
Ashwin.S

1 Like

Hi @MinalGupta
Hope this would help you
Out_datevalue = DateTime.ParseExact(row(“yourcolumnname”).Tostring.Substring(0,10),”dd-MMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture)

Cheers

1 Like

Hi,
I tried as you mentioned and its working perfectly…
Thanks
Kumar

@lakshman , @palaniyappan - Not working in my case as the date in excel is “7 May 2019” format.

StringToDateTime.xaml (5.2 KB)

1 Like

Hi @MinalGupta

Use cdate(strvar). ToString (“dd MMMM yyyy”)

Thanks
Ashwin.S

3 Likes

Hi @MinalGupta

Please try how @AshwinS2 described and the thing is i tried and that’s working…

Thanks

Kumar

1 Like

@AshwinS2 - thanks its working

thanks @kumarD

1 Like

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