03-14-2018 07:28 AM
I am using "Scan from String" function for converting the date format in version 16 Eval.
My input string is "Wed, Sep 27, 2017".
I am expecting output as 27-09-2017.
But, I am getting the error "Error 1 occurred at scan from string".
Snip Attached.
03-14-2018 08:05 AM - edited 03-14-2018 08:07 AM
Hi depme,
My input string is "Wed, Sep 27, 2017".
I am expecting output as 27-09-2017.
So you have an input string of (simplified) "text text numbercomma number".
Your format string tells ScanFromString to look for "numberminusnumberminusnumber".
Which result do you expect from such a format string with this input? (And why don't you implement some error handling?)
03-14-2018 09:31 AM
Hi,
To have your expected value is not possible with only this function because we use "Scan from string" when we know the exact format of the input.
And the input "format string" of the function "scan form string" is not the format that you would expected to have but the format of the input string.And your error is because the "format string" don't matches with your input. change it in the correct form and the results will permit you to have your expected value
Regards,
Fred
Kudos are welcome
03-14-2018 09:35 AM - edited 03-14-2018 09:45 AM
Building on the 2 previous replies, the format string pattern needs to match the input string. And I think there is a misunderstanding of which data type you need the output to be (either timestamp or string). Here's a quick example that extracts the timestamp output and then converts it to a string in the format you've specified:
EDIT: Added timestamp conversion to string output
03-15-2018 06:23 AM
Thanks for the solution.
I was expecting output timestamp as string only.