Hi,
When I use the node String to Date&Time format, in ver 5.2, I am getting the following error message.
java.lang.reflect.invocationTargetException.
Pls advise
Thanks
KRISH
Hi,
When I use the node String to Date&Time format, in ver 5.2, I am getting the following error message.
java.lang.reflect.invocationTargetException.
Pls advise
Thanks
KRISH
Hi @PKRISH , what format mask are you using for the conversion?
Hi @PKRISH,
Apparently, there is a leading space character which causes the issue.
You can use the strip()
function in the String Manipultion node to remove leading/trailing whitespaces:
strip($date$)
Update: It seems that there is a minor issue in the error message and the underline starts one char early (AP-21720). So, the issue here is not a leading space character in the string value.
Would you check your pattern in the String to Date&Time node and make sure there is no leading space in your pattern?
dd-MM-yyyy
Thank you @PKRISH,
I have updated my first reply.
So, by looking at your configuration and the pattern used in the String to Date&Time node (and thanks to @takbb who first asked for it), it appears that your pattern doesn’t match the date format in your data table. You have used yyyy-MM-dd
in the node’s configuration but regarding the error message, the date format is dd-MM-yyyy
(18-04-2008).
Hi Armin.
I was trying various combination of date format and inadvertently pasted a wrong screen shot. I am attaching the correct screen shot with the correct settings. Despite this, I am getting the same error message.
Could you throw light on what could be creating the problem
You are trying to convert dd-MM-yyyy to dd.MM.yyyy which is why the node is complaining If you change the Date format in the node to dd-MM-yyyy it will start working.
I do not see a format as dd-MM-yyyy in the drop down. Could you advise. Thanks
You can just type it in, you’re not restricted to the examples in the dropdown menu.
Hi Scott.
As suggested , i typed the date format as dd-mm-yyyy.
Hi @PKRISH “mm” means “minutes”. You need to use “MM” (or just “M”) for month
Hi @PKRISH , please note that the case is important. You need to be careful to use the examples as they were given. So the year yyyy
remains lower case.
i.e. the format is:
dd-MM-yyyy
or
d-M-yyyy
(or variations of those)
The single d
and single M
allow for day and month both as single digit, or double digit or with leading zero. If you specify dd
or MM
it only matches where the day / month is represented as 2 digits. i.e. d
and M
are less restrictive than dd
and MM
It’s not entirely obvious at first glance, but you get used to it.
The list of formats are those defined for java, and can be viewed here
DateTimeFormatter (Java Platform SE 8 ) (oracle.com)
Hi takbb.
Thanks for the solution. It worked. I was able to execute this node without error message. But the result was in the format of yyyy-MM-dd , though the setting was for dd-MM-yyyy. Any probable reason.
Regards
Hi @PKRISH ,
The format mask you gave tells KNIME how to interpret the String, not how to represent a date once it is an actual date data type.
In common with databases and programming languages, once something is a date in KNIME it has no inherent format.
KNIME will always display dates in yyyy-MM-dd (sortable) format. If at some future point you need a date to be output in a specific format, you always have to convert it back to a String again, eg by using the Date&Time to String.
Thanks. I understand what you have to say reg the date format.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.