Date Conversion Error
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-21 05:55 AM
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
------------------------------
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-21 09:36 AM
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
------------------------------
------------------------------
John Carter
Professional Services
Blue Prism
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-02-21 09:28 AM
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
------------------------------
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
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-02-21 09:55 AM
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
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-02-21 10:08 AM
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
------------------------------
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
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-09-21 06:06 AM
FormatDate(ToDate ([employeeData.DOJ]), "dd/MM/yyyy")
------------------------------
------------------------------
Vipul Tiwari
Senior Process Simplification and Optimization Designer(Solutions Architect)
Fidelity International
------------------------------
------------------------------
------------------------------
------------------------------
Vipul Tiwari
Senior Process Simplification and Optimization Designer(Solutions Architect)
Fidelity International
------------------------------
------------------------------
------------------------------
Vipul Tiwari
Senior Process Simplification Developer
Amazon
------------------------------
