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
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
date.xlsx (348.0 KB)
@Parvathy can u help plz its urgent isssue
@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?
- Excel stores dates as serial numbers:
1 = 01/01/1900
45689 = 07/05/2025
(Example)45689.12800925926
→ Includes time portion as a decimal.
- 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
Date is coming in Double or OAdate format…try using this
DateTime.FromOAdate(currentRow(0).ToString).ToString("dd-MM-yy")
cheers