web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / V4CalendarPostItem mak...
Power Apps
Answered

V4CalendarPostItem makes an event as UTC time if you don't use DateTImeValue

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello

 I use V4CalendarPostItem to make an event on calendar but it should be register as UTC time.
As https://docs.microsoft.com/en-us/connectors/office365/#create-event-(v4)
start time and end time parameters are date-no-tz type. If I use data-no-tz(ie. '2017-08-29T04:00:00'), 
the calendar event should be registered as UTC time zone. ( register time is correct but time zone is UTC)

 

I found a workaround to use  DateTimeValue with locale to register own local time zone.

I don't understand the behavior of time zone mechanism of  V4CalendarPostItem.

 

Register as UTC time zone but registered time is correct even it is UTC time zone.

 

 

Office365Outlook.V4CalendarPostItem(
 G_CalendarID,
 VarCalTitle,
 VarCalStartTime,
 VarCalEndTime,
 "Tokyo Standard Time",
 {
 body: RichTextEditorBody.HtmlText,
 showAs: GlbVar.ShowAs }
 )

 

 

Register correctly as Tokyo Standard Time 

 

 

Office365Outlook.V4CalendarPostItem(
 G_CalendarID,
 VarCalTitle,
 DateTimeValue(VarCalStartTime,"ja-JP"),
 DateTimeValue(VarCalEndTime,"ja-JP"),
 "Tokyo Standard Time",
 {
 body: RichTextEditorBody.HtmlText,
 showAs: GlbVar.ShowAs }
 )

 

 

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Actually, it is an known issue with Office365Outlook.V4CalendarPostItem function. The Start Time and End Time of an event is actually a dateTimeTimeZone type, in default, the Start Time and End Time is in UTC format.

    Please check the following article for more details about properties of an event:

    https://docs.microsoft.com/en-us/graph/api/resources/event?view=graph-rest-1.0#properties

     

    When you specify a date time value for the Start Time and End Time arguments in the V4CalendarPostItem function, you should specify the date time value in UTC format as below:

     

    "2020-05-25T15:35:00Z" // yyyy-MM-ddTHH:mm:ssZ

     

    I have made a test on my side, the standard formula format as below:

    8.JPG

     

    Office365Outlook.V2CalendarPostItem(
     CalendarDropdown.Selected.Name, 
     SubjectBox.Text, 
     Text(StartDatePicker.SelectedDate + Time(Value(StartHour.Selected.Value), Value(StartMinute.Selected.Value),0), "[$-en-US]yyyy-mm-ddTHH:mm:ssZ"), 
     Text(EndDatePicker.SelectedDate + Time(Value(EndHour.Selected.Value), Value(EndMinute.Selected.Value),0), "[$-en-US]yyyy-mm-ddTHH:mm:ssZ"),
     {
     TimeZone:"(UTC+08:00) Kuala Lumpur, Singapore", // The value should be chosen from the available options
     Body: BodyBox.Text
     }
    )

     

     

    On your side, you should modify your formula as below:

     

    Office365Outlook.V4CalendarPostItem(
     G_CalendarID,
     VarCalTitle,
     Text(VarCalStartTime, "[$-en-US]yyyy-mm-ddTHH:mm:ssZ"), // Modify formula here
     Text(VarCalEndTime, "[$-en-US]yyyy-mm-ddTHH:mm:ssZ"), // Modify formula here
     "Tokyo Standard Time",
     {
     body: RichTextEditorBody.HtmlText,
     showAs: GlbVar.ShowAs 
     }
    )

     

    Note: Use the Text function to format the date time value as a UTC format date time value string.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi、

    Thank you for your response.

     

    My actual code here for start and end time. I already define it as UTC format. 

     UpdateContext(
     {
     VarCalStartTime: Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnStartHr.Selected.Value),
     Value(DrpDwnStartMnt.Selected.Value),
     0
     ),
     DateTimeFormat.UTC
     ),
     VarCalEndTime: Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnEndHr.Selected.Value),
     Value(DrpDwnEndMnt.Selected.Value),
     0
     ),
     DateTimeFormat.UTC
     )
     }
     )

     

    Then I confirmed the start/end variable as UTC format.

    timezoneText.JPG

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

    As you mentioned manual of dateTimeTimeZone,   

    "start dateTimeTimeZone The date, time, and time zone that the event starts. By default, the start time is in UTC."


    I suppose my code is also fine because 

    VarCalStartTime is defined as UTC format by Text()
    Then VarCalStartTime is changed to dateTimeTimezone by DateTimeValue()

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Based on the formula that you mentioned, I think there is something wrong with it. If you format the Start Time or End Time using the following formula:

    Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnStartHr.Selected.Value),
     Value(DrpDwnStartMnt.Selected.Value),
     0
     ),
     DateTimeFormat.UTC
     )

    it would convert your picked up date time value into a UTC time.

     

    But the important thing you need to know is that -- when working date time value in canvas app, it would be converted into UTC format automatically. In other words, if you are in UTC + 7 time zone, and you picked up "05/25/2020 03:00 PM" date time value from your canvas app, when passing this date time value in your V4CalendarPostItem() function as Start Time or End Time, it would be converted into "05/25/2020 08:00 AM" date time automatically, and pass this converted date time value to your Outlook. Then based on the time zone attribute you specified in V4CalendarPostItem() function, the "05/25/2020 08:00 AM" date time value would be converted into corresponding Time Zone value. E.G. if you specify your own local time zone for the "time zone" attribute, the passed date time would be converted into your local time zone.

     

    So you could not format your picked up date time value into UTC format manually using the following formula:

    Text(...., DateTimeFormat.UTC)

    If you passed above date time string value into your V4CalendarPostItem() function, it would be considered as your picked up date time value from your canvas app, and it would be converted into UTC time value again, then it would cause time zone issue (date time offset) when you create event in your Outlook.

     

    On your side, please format the picked up date time value using the following formula:

    Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnStartHr.Selected.Value),
     Value(DrpDwnStartMnt.Selected.Value),
     0
     ),
     "yyyy-MM-ddTHH:mm:ssZ" // specify the format here
    )

     

    If the solution I provided above is helpful in your scenario, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi 

     I changed the code as you mentioned. But it still be registered as UTC.

    UpdateContext(
     {
     VarCalStartTime: Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnStartHr.Selected.Value),
     Value(DrpDwnStartMnt.Selected.Value),
     0
     ),
     "[$-ja]yyyy-mm-ddTHH:mm:ssZ"
     ),
     VarCalEndTime: Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnEndHr.Selected.Value),
     Value(DrpDwnEndMnt.Selected.Value),
     0
     ),
     "[$-ja]yyyy-mm-ddTHH:mm:ssZ"
     )
     }
     )

    and

    Office365Outlook.V4CalendarPostItem(
     G_CalendarID,
     VarCalTitle,
     VarCalStartTime,
     VarCalEndTime,
     "Tokyo Standard Time",
     {
     body: RichTextEditorBody.HtmlText,
     showAs: GlbVar.ShowAs }
     )

      

    What's is wrong ???

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    I think I have missed something with your Formula, you used Office365Outlook.V4CalendarPostItem(), but I used Office365Outlook.V2CalendarPostItem() function.

     

    If you use Office365Outlook.V4CalendarPostItem() function to achieve your needs, I agree with you, you should modify your formula as below:

    UpdateContext(
     {
     VarCalStartTime: Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnStartHr.Selected.Value),
     Value(DrpDwnStartMnt.Selected.Value),
     0
     ),
     DateTimeFormat.UTC
     ),
     VarCalEndTime: Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnEndHr.Selected.Value),
     Value(DrpDwnEndMnt.Selected.Value),
     0
     ),
     DateTimeFormat.UTC
     )
     }
     )

    and

    Office365Outlook.V4CalendarPostItem(
     G_CalendarID, 
     VarCalTitle, 
     VarCalStartTime, 
     VarCalEndTime,
     ""(UTC+09:00) Osaka, Sapporo, Tokyo"", // Selected the specific time zone from the provided available options
     {
     body: RichTextEditorBody.HtmlText,
     showAs: GlbVar.ShowAs
     }
    );

     

    If you want to use Office365Outlook.V2CalendarPostItem() function, please try the following formula:

    Office365Outlook.V2CalendarPostItem(
     G_CalendarID, 
     VarCalTitle, 
     Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnStartHr.Selected.Value),
     Value(DrpDwnStartMnt.Selected.Value),
     0
     ),
     "[$-ja]yyyy-mm-ddTHH:mm:ssZ"
     ),
     Text(
     DatePickerWorkDay.SelectedDate + Time(
     Value(DrpDwnEndHr.Selected.Value),
     Value(DrpDwnEndMnt.Selected.Value),
     0
     ),
     "[$-ja]yyyy-mm-ddTHH:mm:ssZ"
     ),
     {
     TimeZone: "(UTC+09:00) Osaka, Sapporo, Tokyo", // Selected the specific time zone from the provided available options
     Body: RichTextEditorBody.HtmlText
     }
    );

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi

     

    Yes. I use V4 function.

    I understand my code is right.

    Thanks a lot.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard