I want to convert excel custom to date format in uipath



in excel my date format is in custom and i am using Convert.ToDateTime(CurrentRow.Field(Of String)(“Transaction Date”).Substring(0, 19)).ToString(“dd-MMM-yy”) this to convert the excel date to 19-feb-25 but i am getting above error .can some one help me in this ?

hi @SSD

Try this
Convert.ToDateTime(CurrentRow.Field(Of String)(“Transaction Date”).ToString.Split(" ")(0)).ToString(“dd-MMM-yy”)

Hope this helps


still getting this error

Hi @SSD

Try the below syntax:
FormattedDate = DateTime.ParseExact(CurrentRow("Transaction Date").ToString.Split(" ").First(), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy")

If possible share sample input excel, I will help you out


getting this error

Hi @SSD

Can you share the excel if possible.

Regards

date.xlsx (348.0 KB)

@Parvathy can u help plz its urgent isssue

Hi @SSD

Check the below workflow:

Sequence2.xaml (9.0 KB)

Hope it helps!!


still getting this error
@Parvathy

Hi @SSD

Can you share the workflow file.

Regards

@SSD
You’re getting this issue because Excel stores dates as serial numbers, and when you read the Excel file in UiPath, it might interpret the date column as a double (numeric) value instead of a proper DateTime format.

Why is this happening?

  1. Excel stores dates as serial numbers:
  • 1 = 01/01/1900
  • 45689 = 07/05/2025 (Example)
  • 45689.12800925926 → Includes time portion as a decimal.
  1. UiPath reads the value as a string or double:
  • When reading Excel data using the Read Range activity, dates might be interpreted as doubles instead of DateTime.

Fixing the Issue

Solution 1: Convert Excel Serial Number to DateTime

If the value is stored as a number in the DataTable, convert it using:

DateStringVariable = DateTime.FromOADate(CDbl(row("Transaction Date").ToString())).ToString("dd-MMM-yy")

This will convert the serial number to an actual DateTime format.

Solution 2: Preserve Formatting in Read Range

  • If you are using the Workbook Read Range, try switching to the Excel Application Scope and enable the PreserveFormat property.

Hope this helps

@SSD

Date is coming in Double or OAdate format…try using this

DateTime.FromOAdate(currentRow(0).ToString).ToString("dd-MM-yy")

cheers