Jan 10 2020 05:58 AM
Jan 10 2020 05:58 AM
I am having great difficulty with a flow where I have an input date in this format: 'dd-MM-yyyy hh:mm' and I want the flow to create an event on that specific time.
I have used this function:
formatDateTime([input data],'dd-MM-yyyy hh:mm')
It works fine for '09-03-2020 10:00', but not for '14-03-2020 10:00'.
See the picture - this is the event correctly created in my calendar for the input
At the bottom, the date in the text is the output of the exact same function as the one used to create the event.
So why does it turn the date and month around, when it is correctly added to the calendar, and why is it not able to process the second input example?
Jan 12 2020 03:42 PM
I'll make some assumptions here as there's some missing pieces to your puzzle.
If your date format is already input in the right format (e.g. 14-03-2020) then the expression you use will switch the numbers around to be 03-14-2020 which will give you the error you have seen.
If the date is captured as MM-dd-yyyy (e.g. 03-14-2020) then your expression will correctly switch it around to dd-MM-yyyy (14-03-2020).
Based on what you have in the Event body where the date has switched to 03-09-2020, are you sure that this is the same expression as the create event one? It would seem to be formatted as MM-dd-yyyy. Might be worth revisiting the expression for that bit.
If you can provide a screen grab of the Create Event, it would help to see what might have gone wrong if the above hasn't helped diagnose the issue.
It would also be helpful to know how the date is initially captured, as I suspect the issue is to do with how you capture the date.
Jan 12 2020 03:45 PM
Hi again @Maria_DK
Additionally, I also use Convert time zone to ensure that the initial date captured is properly converted to my desired format for my time zone.
You may find using this to be more useful than the expression!
Jan 14 2020 02:43 AM - edited Jan 14 2020 02:45 AM
Hi @Damien Rosario,
Thank you for your reply.
The date is captured from a choice text field in a Form, where I have written the date as '09-03-2020 10:00'. So there is no date format in the input itself, it is only a string.
In the screenshot you can see how I create the event.
The expression in the text is an exact copy of the one in the start time expression.
As I have set the time zone in the event itself, I do not see the need for converting time zone here.
If I do not specify any format, the event is created at the wrong date.
Are you saying that if my input is in the correct format and I use formatDateTime to make sure it keeps that format, it then changes the format? That makes no sense to me. And I cannot see how else I should turn the input into a date so I can use it for creating an event.
Here you can see the input and output from running the flow:
Create event input:
Create event output: