I’m a beginner to developing bots in studio and I have a problem I was hoping someone could help with.
I’m using an assign activity in a ‘For Each Row’ loop to run through my datatable capture an existing date from a particular column and then assign this date to different column in the datatable. The problem is my output is in the date format MM/dd/yyyy and I require it to be dd/MM/yyyy.
After searching for solutions using DateTime.ParseExact seems to be the most popular method but I am encountering a compiler error. The error message states ‘Globalization’ is ambiguous, imported from the namespaces or types ‘System.Web, System’.
My datatable does not have column headers so I am referencing the data using row(). Please see my code below.
Hi. That’s weird if System.Globalization still does not work, but you always can use
DateTime.ParseExact(row(4),“MM/dd/yyyy”, Nothing).Tostring(“dd/MM/yyyy”)
I tried your suggested code but this did not seem to work either, however I have noticed in my original code I was missing the ‘System’ before globalization.
I have now changed this to read DateTime.ParseExact(row(4),“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).Tostring(“dd/MM/yyyy”)
The compiler error has now changed to Option Strict On disallows implicit conversations from ‘Object’ to ‘String’
I have updated as below and that has worked in terms of getting rid of the compiler error but for some reason my date is still being output in the format MM/dd/yyyy.