cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ElleB
Regular Visitor

Create event with the correct date and time from SharePoint List

Hi,

 

I'm unable to get both the correct date and time when using "Create an Event."  The calendar event uses information from a SharePoint list (populated by an MS Form). The MS form has a date field but the time is a text field. When the activity date is the start/end time, the calendar invite has the correct date but the default time of 12:00 am. When the activity start/end time is used, the appointment date is today's date with the correct time. 

How can I get both the correct date and start and end time on the calendar appointment?

 

SharePoint List

ElleB_0-1650555714314.png

 

Flow using start/end time - correct time but the default is today's date

ElleB_1-1650555772581.png ElleB_3-1650555821755.png

 

Flow using activity date-correct date, the default time

ElleB_4-1650555963126.pngElleB_6-1650556002245.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ElleB
Regular Visitor

@takolota @v-bofeng-msft 

There is probably a much more elegant solution with fewer steps but here's what worked for me:

1. Remove time from date. (Date is from a date picker and automatically includes a default time)

formatDateTime(variables('EventDate'),'yyyy-MM-dd')
ElleB_2-1651851521510.png

 

 
2. Convert Start and EndTime ( text fields) to military time so that the hour is recorded. This solves for the AM/PM problem. 
formatDateTime(variables('StartTime'),'HH:mm:ss')
 
3. Combine (concat) the new new start/end time with the new date.
concat(outputs('Compose'),'T',outputs('Compose_3'))
 ElleB_1-1651851470521.png

 

4. In Create event, use the new "outputs" from the conversions of start and end time as the start and end time.
ElleB_0-1651851431574.png

 

 

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @ElleB ,

 

Because the time displayed in SharePoint is local time (according to SharePoint's time zone settings)

vbofengmsft_0-1650856913219.png

 

when Flow reads this time value and passes it to flow, this time will be converted to UTC time. For example:

 

I'm assuming your SharePoint set timezone is UTC+8 and the start time in SharePoint is 2022-04-25T09:00:00 . And then you will get 2022-04-25T01:00:00 in your flow. Because the date offset in the UTC+8 area is 8 hours, the corresponding UTC time needs to be subtracted by 8 hours, so the date we get in Flow is 8 hours less. To make up for the missing 8 hours, we need to add another 8 hours.

vbofengmsft_1-1650857063599.png

 

Best Regards,

Bof

 

    

Hi,

Thanks for the reply. Time zone is not the issue. The event date and time are recorded differently and in different fields. Event date is pulled from MS Forms date picker and event time is a text field. using date in "Create an Event" only produces the date, not the time on the calendar, and using the event time produces the correct time but the incorrect date (the default is today's date since there is no time picker in MS forms.) It looks like I need to combine the date and time variables as in the example linked below but need assistance writing the correct formula. https://powerusers.microsoft.com/t5/Building-Power-Apps/New-variable-that-combines-Date-and-Time-var...

takolota
Super User
Super User

@ElleB 

 

You should be able to use the concat expression to combine the correct date with the correct time. Set it to only take the “yyyy-MM-dd” from the correct date and only take “HH:mm” from the correct time.

ElleB
Regular Visitor

@takolota @v-bofeng-msft 

There is probably a much more elegant solution with fewer steps but here's what worked for me:

1. Remove time from date. (Date is from a date picker and automatically includes a default time)

formatDateTime(variables('EventDate'),'yyyy-MM-dd')
ElleB_2-1651851521510.png

 

 
2. Convert Start and EndTime ( text fields) to military time so that the hour is recorded. This solves for the AM/PM problem. 
formatDateTime(variables('StartTime'),'HH:mm:ss')
 
3. Combine (concat) the new new start/end time with the new date.
concat(outputs('Compose'),'T',outputs('Compose_3'))
 ElleB_1-1651851470521.png

 

4. In Create event, use the new "outputs" from the conversions of start and end time as the start and end time.
ElleB_0-1651851431574.png

 

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (5,231)