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

Formatting Google Calendar Start/End Times

 

Hi, I'm working on creating my first flow as an integration between Esri's Survey123 and Google Calendar. The basic premise is, someone submits a survey, and fields within that response are used to generate a calendar event.

 

Because of the original time format (incoming as UNIX) , I'm converting both an input start/end time using addSeconds, with the conversion result for both being UTC-05:00. I then want to feed the result of these conversions into the Google Calendar "Start time" and "End time" fields. Here is my addSeconds conversion. Below is a screen capture of my flow.

 

addseconds('1970-1-1', Div(triggerBody()?['feature']?['attributes']?['Decon_Appt_Start'],1000) , 'yyyy-MM-ddTHH:mm:ss')

When I test my flow, the Google Calendar portion fails with the error: 

{
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "invalid",
        "message": "Invalid value for: Invalid format: \"8/15/2018 9:30 AM\" is malformed at \"/15/2018 9:30 AM\""
      }
    ],
    "code": 400,
    "message": "Invalid value for: Invalid format: \"8/15/2018 9:30 AM\" is malformed at \"/15/2018 9:30 AM\""
  }
}

 

I've been messing around with the Format String option in "Convert Time Zone", but it seems like regardless of what I select, I still get a similar error to the one above. Looking now, my screen capture has a different Format String option set than what trigger that particular error above. Either way, it shouldn't matter as they all fail with the same problem.

 

Any suggestions on how to get Google Calendar to consume my date/times would be appreciated.

FlowCapture.PNG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @v-yamao-msft,

 

Thank you for getting back to me! I was actually able to figure out a solution to my problem, however I don't know if it is "the proper" way to have corrected my issue - but it works!

 

I started looking more closely at my Format String, and changed the syntax here to 'yyyy-MM-ddTHH:mm:ss.fffZ' after stumbling across a posting on GitHub. This solution seemed to work, however I also needed to change my Source and Destination Time Zones to both be equal to UTC-05:00 (which didn't quite make sense to me), but this allowed the calendar appointment to show up properly.

 

Erica

View solution in original post

3 REPLIES 3
v-yamao-msft
Community Support
Community Support

Hi @erica_tefft,

 

I have made a test on my side trying to convert the unix timestamp to UTC format.

 

The code I am using is:

formatDateTime(addDays('1970-01-01T00:00:00Z',div(triggerBody()['number'],86400)),'yyyy-MM-ddTHH:mm:ss')

The flow is configured as:

1.PNG

 

Please take this doc for a reference:

https://www.epochconverter.com/ 

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yamao-msft,

 

Thank you for getting back to me! I was actually able to figure out a solution to my problem, however I don't know if it is "the proper" way to have corrected my issue - but it works!

 

I started looking more closely at my Format String, and changed the syntax here to 'yyyy-MM-ddTHH:mm:ss.fffZ' after stumbling across a posting on GitHub. This solution seemed to work, however I also needed to change my Source and Destination Time Zones to both be equal to UTC-05:00 (which didn't quite make sense to me), but this allowed the calendar appointment to show up properly.

 

Erica

Hi @erica_tefft,

 

I am glad to hear that it is working for you now. And thanks for your sharing.

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (2,371)