Variable date/time format with am/pm

I am attempting to read-in the following date/times, where the day and month can be either a single or double digit, and have looked through a number of related threads without arriving at a solution.

1/1/2017 12:00:00 AM
1/1/2017 5:00:00 AM
11/15/2017 10:00:00 AM

In 3.235 “String to date” node I’ve tried;

*d/*M/yyyy *h:mm:ss aa (and with just a)
dd/MM/yyyy hh:mm:ss aa (and with just a)
d/M/yyyy h:mm:ss aa (and with just a)

I am in Wildcard mode for the first one, of course, though I cannot get a Match to Include, it stays stuck in Mismatch Exclude.

I was successful using this node on a different data source that was 24hr time and had a single format for datetime (e.g., 01/02/2017 01:00:00)

Am I using the right date conversion node for this datetime input format?

@WilliamStewart welcome to the KNIME forum. Di you have a look at this example and the linked discussions?

2 Likes

I had already looked at the linked solution by you, which does not appear to solve my problem. I don’t understand what is going on in the diagram in the link you provided above as I can’t see how the nodes are configured.

Here’s what my workflow looks like right now, with some experimenting.

KnimeDateTimeParsingIsolate

@WilliamStewart You can actually download the workflow and see the configuration for yourself. In the example there is an if then condition in the Rule Engine node.

3 Likes

Ok, that resolved the matter. I thought I had to build a reg expression in the upper area, and that the entry area in the lower area was only a picklist. Now I see it’s a combo.

Thanks!

1 Like

Glad it did work. If you want to further explore the possibilities and quirks of date and time variables I have a small collection of example workflows.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.