I am importing fields from Excel to my journal. The problem is - it does not import dates that have a dot or slash in end of the date, like 01.01.2020.
The field is just empty.
I am trying to find a way to remove teh last symbol, if it exists. I tried str test = date2Str(_country, 123, -1, -1, -1, -1, -1, -1);
, but it will take data that does not have a dot or slash in the end. It could be easy to work with date if it was a string, but I am failing to convert it to a string because of that dot or slash in end of the date...
It only converts 01.01.2020
format but it does not convert 01.01.2020.
Any suggestions would help a lot. Thanks.
Option 1
Clean up the source data. I cannot image that Excel stores proper date values with a trailing .
or /
.
Option 2
How are you fetching the Excel values? Does your third party (?) solution offer a method like myCell.getDateValue()
that returns a date
type instead of a string
type?
Option 3
You could apply a simple substr()
with length=8 to trim of any trailing characters. The line of code below works for me.
date d = str2Date(subStr('01.01.2020.', 1, 8), 123);