DateTime Input to dd/MM/yyyy from "June 5, 2023 8:00 AM" format

Hello,

The input in my datatable is in this format “June 5, 2023 8:00 AM”
I want to convert each date in my file to dd/MM/yy format
Keep getting errors using System.Globalization.etc

Can you help please?
Thank you

@Orchestrator_Practice

Try this

DateTime.ParseExact(str,"MMMM d,yyyy h:mm tt",system.Globalization.cultureinfo.invariantculture).ToString("MM/dd/yy")

Cheers

Thank you. Getting Error BC30455: Argument not specified for parameter ‘Number’ of ‘Public Function Str(Number As Object) As String’

@Orchestrator_Practice

Str is the variable which contains your date you have to replace it with actual variable

Cheers

My Assign has CurrentRow(“Start”) = above expression

When running, getting Assign Expression Activity Type ‘VisualBasicValue1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

@Orchestrator_Practice
DateTime.ParseExact(CurrentRow(“Start”).ToString,“MMMM d,yyyy h:mm tt”,system.Globalization.cultureinfo.invariantculture).ToString(“MM/dd/yy”)

@Orchestrator_Practice

Looks like you copied the inverted comma …try temoving it and replace it with inverted comma in code again and please use .ToString

Correct - "
Wrong - “

Cheers

@Orchestrator_Practice
Try this one

CDate(DateTime.ParseExact(CurrentRow(“Start”).ToString,“MMMM d,yyyy h:mm tt”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yy”))

I had to convert all inverted commas and it ran. No ‘VisualBasicValue1’ error but now returns: Assign: String ‘June 5, 2023 8:00 AM’ was not recognized as a valid DateTime

MS Project exported everything as string. Will likely need to covert to date format then?

@Orchestrator_Practice did you try above both expression ?

CDate returns: Assign String ‘June 5, 2023 8:00 AM’ was not recognized as a valid DateTime

Find below help for analysing and possible corrections of a modelling:

Schedule Bot Home Construction Project v2.xlsx (11.2 KB)

MS Project Export Wizard spit out the dates in this format. Trying to standardize the dates before sending out to stakeholders. Was hoping UiPath could convert the Start / Finish Columns to dd/MM/yy format.

Changed universal Project settings to dd/MM/yy and shows up like this in Project:


but exports the data in the goofy format and gives no options for changing. No need to automate a bad process but Project is giving few options.

Resultant Excel File dates even resist format painter to convert manually

Thanks for your help and suggestions. The solution was to export in project using csv vs Excel and the format returned normally.

1 Like