Get time of an appointment?

I get an appointment thru a Webhook.
Now i try to split it in date and time.
How do i do this in an item-function node?
I got an appointment look like this in the Json-Body: “startDate”: “2022-04-27 15:45:00”,

With:
item.StartDate = $node[“Webhook Kalendar.Digital”].json[“body”][“startDate”].substring(0,10);
i get the date (YYYY-MM-DD) that’s ok.
How do i get the time of the appointment?
item.StartTime = $node[“Webhook Kalendar.Digital”].json[“body”][“startDate”]???;
I try:
item.StartDate = $node[“Webhook Kalendar.Digital”].json[“body”][“startDate”].substring(12,8);
but this does not work.

Hey @UweG, I hope you’re well?

.substring() works slightly different. The first parameter would be the index of the first character to return, the second parameter, the second parameter is optional and would be the first character to exclude from the return value.

The index is 0 based, so for your example value the indices would be as follows:

Value: 2022-04-27 15:45:00
Index: 0123456789...

So to get everything from position 11 onwards, you’d want to use .substring(11).

Hope this helps!