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:
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