cancel
Showing results for 
Search instead for 
Did you mean: 

Date Conversion Error

KarthikBallary
Level 5
Hi

I need to convert text to date. I am getting error for the dates entered above 13+ like 13/01/2021, 14/01/2021.

Internal : Failed to evaluate expression 'ToDateTime([employeeData.DOJ])' - Unable to convert supplied value to a DateTime : Text value '25/2/2021' cannot be interpreted as a DateTime

------------------------------
Karthik Ballary
------------------------------
5 REPLIES 5

John__Carter
Staff
Staff
It sounds like it's a formatting issue, eg month vs day. Perhaps you could parse the string beforhand?

------------------------------
John Carter
Professional Services
Blue Prism
------------------------------

Hi Karthik

You are converting to datetime but the value you are passing in is only a date have you tried using ToDate() instead? if you still have the issue try casting the value to a separate data item without converting so just use a calculation step to pass the text value a new data item which has a format of Date set in it. You should be able to read it from the new data item. As John previous mentioned it is likely a format issue or from the value you are trying to convert, try adding in trim to your function to remove any spaces at the start and end that might be causing this and go through the values in the collection to make sure there are no unexpected characters in any of the date fields. If this all looks ok you could also try defining the format in the function e.g. FormatDate(ToDate([employeeData.DOJ]), "dd/MM/yyyy")

Hope this helps 🙂


------------------------------
Michael ONeil
Technical Lead developer
Everis Consultancy
Europe/London
------------------------------

arghya.b
Level 6

Hi,

I think the date format should match "MM/dd/yyyy" format but in your case its coming as "dd/M/yyyy" so you can try first to format the DOJ time to "MM/dd/yyyy" the then can try .


Arghya



------------------------------
Arghya Bhattacharyya
RPA Developer
Asia/Kolkata
------------------------------

Hi Michael,

I think if we use ToDateTime() also it will return the value with 12:00:00 AM ,I guess the issue is with the format either needs to pass as date type or format should match with "MM/dd/yyyy"


------------------------------
Arghya Bhattacharyya
RPA Developer
Asia/Kolkata
------------------------------

EVIPUTI
MVP
FormatDate(ToDate ([employeeData.DOJ]), "dd/MM/yyyy")

------------------------------
------------------------------
Vipul Tiwari
Senior Process Simplification and Optimization Designer(Solutions Architect)
Fidelity International
------------------------------
------------------------------
------------------------------ Vipul Tiwari Senior Process Simplification Developer Amazon ------------------------------