Question

7
Replies
431
Views
SeanB897 Member since 2017 24 posts
Nationwide Building Society
Posted: November 6, 2018
Last activity: November 7, 2018
Closed

Convert DateTime Util from US Format (MM/dd/yyy) to UK Format (dd/MM/yyyy)

All,

I wish to convert the default US Format into UK Format as part of an automation.

The automation I have is very simple see screen shot:

However I am presented with the error below:

The script I am trying to use to convert the format from MM/dd/yyyy to dd/MM/yyyy is below:

public string Dateformat(string USdate)

{

string date = USdate; // en-US formatted date

// Convert to DateTime

DateTime parsedDate = DateTime.ParseExact(date, "MM/dd/yyyy", CultureInfo.InvariantCulture);

// Output in en-GB format

return parsedDate.ToString("dd/MM/yyyy");

}

Any help to resolve this would be much appreciated. The desired result is when I transfer Now() into an excel spreadsheet the format of the date is dd/MM/yyyy

Robotic Process Automation
Moderation Team has archived post
Share this page LinkedIn