Serious Error in Date%Time to string node

Hi @TotalDataLoss -

You raise many interesting questions, many of which I had not thought of before. Let me see if I can succinctly reply.

The best resource I have found so far for Java datetime is the one I linked you. I think the main takeaway from that link is that generally speaking you should use ‘y’ instead of ‘Y’. (It turns out ‘u’ is also fine, but this is not intuitive so I would avoid it for that reason.) I didn’t know ‘Y’ could cause problems myself, so I wonder if we shouldn’t include a warning to that effect in the configuration dialog somewhere.

All of the “new” (meaning not legacy) Date&Time nodes in KNIME should use the same Java basis under the hood, so internal consistency shouldn’t be a problem. These new nodes are what we recommend for parsing dates and times, understanding that the java methods can be a little bit opaque, as you have found.

The Unix Timestamp node shouldn’t cause any surprises since it just counts seconds from the 1 Jan 1970 epoch, using a standard year ‘yyyy’.

In short, I think the most unpleasant surprise of ‘yyyy’ vs ‘YYYY’ is the one you have already discovered. I can mention to our team that this is something that could use more clarity.

1 Like