Webhook information format into n8n. date and time

Hello, I have a voice agent connected on n8n connected to VAPI, I was wondering how you can change the date and time format that the webhook in n8n detects it as. As i specifically need to format to be “yyyy-mm-dd” and 24H for example 18:00 meaning 6pm. I will attached en example of it below.

I need it to detect “3 de la tarde” (3pm) as 15:00. and “7 de septiembre” as 2025-09-07. If anyone has any experience with vapi or any idea on how to do this id highly appreciate it. Thanks.

Hey @Dexiuzhan hope all is good. Your best best would be to message an AI model and compile a datetime from this JSON.

Here is an example:

The input and the output:

Hi thanks for the information. I need it to make the changes as the screenshot I have attached below.

Currently i have the node below that detects the information from the webhook.

Which is giving me an error as the formatting is not yyyy-mm-dd and doesnt allow the data to match within the database sheet.

What is the question?

How would I implement your solution into my workflow? As it has to send data into a specific sheet and field in airtable. As the information in the “reserva” node is connected via the information the webhook receives from vapi.

As to how/where… well, before the information about “reserva” is being used, you could send it to the LLM for proper compilation into a datetime string. Or you could do it right at the start - after the webhook.

I have done it this way but the I am not sure how the ouput of the message model works.

The output of the reserva node is still the same as before and did not change.

The output works exactly the same was as other nodes - it produces the JSON, where the field you are looking for is content. So in the next node you could use an expression
{{ $json.message.content }} to get the formatted date.

like this?

If you are asking if this is how you use the data from the output of the previous node - yes, it is. If on the other hand you are asking if this is what you are supposed to do - I have no idea, this is your flow, only you know the table, what needs to be filled… it does strike me as something that isn’t entirely correct because both “fecha” (date) and “hora” (hour) will be equal to 2024-09-07T15:00:00Z, which probably isn’t something you are looking for.

I’ve updated my example a bit to better detect the year (it used to think that today is 2024).

yeah what I am looking for is to have the date and time separately, in this example it is combined. So “Fecha” as 2025-09-07 and “Hora” as 16:00. Would I need to add another message model or can it be done in the same one?

Ok, here is your updated ai agent:

Access the date with {{ $json.content.date }} and time with {{ $json.content.time }}.

2 Likes

Thank you so much it did work!

I just had another questions about adding new dates and times automatically. I was wondering how to make a workflow which would trigger every X amount of time to add future dates and times as time passes on and delete old fields from that past in the datebase. So I do not have to manually add and delete the dates and times. I attached an example below of ideally how the workflow should add the information into the sheet.

Feel free to create a new topic for this question.

1 Like

@jabbson I just had another issue regarding the year of the date. I was testing it earlier and when the input was a date in 2026, for example 6th of February, it detected it as 2025-02-06, and sometime a year from the past such as 2023. I tried modifying the prompt but it was unsuccessful from my side. Any tips on how to solve this?

The only way to explain how to do certain things to the agent is via the system prompt. If the agent is not properly using the year you will need to add explanations which year to use for the date. When you prepare the date handling prompt, you will need to think of what happens when the user will be scheduling something for the next year - for instance on December 31, the user schedules something for January, 3. It will need to realize that the date is for the next year. You also need to be able to handle and think of what if the user explicitly asks to schedule something for the year of 2030 or 1680.

Okay, so the only way to fix this will be by modifying the system prompt? If it is, please let me know and I will try add several prompts.

Yes, the only way to do it is with system prompt. As ti how - you will need to write the logic yourself. A quick attempt on my side:

If this isn’t covering some corner cases, add to the prompt.

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