cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Creating a Date/Time value using string

Within Power Apps I have a Date field and two dropdown fields. 

 

As Power Apps does not have a Date/Time field I am using this as Date, Hour (0-23 intervals of 1) and Minutes (0-50 intervals of 10).

 

I would like to use Power Automate to store this in a format that SharePoint would accept as my initial attempt was to use the below:

 

 

concat(outputs('Date'),' ',outputs('Hour'),':',outputs('Minute'))

 

 

Although this doesn't fail and it populates the list, it only enters the date with the time always being midnight.

 

Any ideas or recommendations would be appreciated! 😊

 

Thanks

 

Bradley

Best regards,

Bradley
If this post helps, then please consider Accept it as the solution to help the other members find it more
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Creating a Date/Time value using string

@burgett94 

Please see my example below.  I use three compose actions to store the components of the date time string.  In the FullDate compose action I use a concat action to create a valid date/time string - the expression can be seen in the action comments.  Then, I use a convert timezone action because SharePoint stores everything in UTC.  I then use the output of the convert timezone action to update the SharePoint list.  Please let me know if you have additional questions.

DateTime.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Creating a Date/Time value using string

@burgett94 

Please see my example below.  I use three compose actions to store the components of the date time string.  In the FullDate compose action I use a concat action to create a valid date/time string - the expression can be seen in the action comments.  Then, I use a convert timezone action because SharePoint stores everything in UTC.  I then use the output of the convert timezone action to update the SharePoint list.  Please let me know if you have additional questions.

DateTime.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Highlighted
Community Support
Community Support

Re: Creating a Date/Time value using string

Hi @burgett94 ,

 

Please take a try with @ScottShearer 's sussestion.

 

Best regards,

Alice       

 

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

Highlighted
Super User
Super User

Re: Creating a Date/Time value using string

Hello @ScottShearer 

 

Sadly it is not working, I get the below when using:

 

concat(outputs('Date'),'T',outputs('Hour'),':',outputs('Minute'),'00Z')

 

 Annotation 2020-02-12 091116.png

 

I tried amending the hour as it was missing the initial zero as shown, so I added the below to the Compose for Hour

 

if(equals(length(triggerBody()['Hour_Inputs']),1),concat(0,triggerBody()['Hour_Inputs']),triggerBody()['Hour_Inputs'])

 

Which now pulls through the Hours as 08 if length is 1 character (i.e. 0-9).

 

The next issue I thought it could be was the date was pulling through as US Format so I used the below for the Compose for Date

 

formatdatetime(triggerBody()['Date_Inputs'],'dd/MM/yyy')

 

Sadly, this didn't work either.

 

Anything else I can try?

 

Thanks

 

Bradley

Best regards,

Bradley
If this post helps, then please consider Accept it as the solution to help the other members find it more
Highlighted
Super User III
Super User III

Re: Creating a Date/Time value using string

@burgett94 

Your date must be in a format that looks like this:  2020-02-12 

The format string is yyyy-MM-dd

In the example below, I use a compose action and a formatDateTime expression to convert to the proper format.

ConvertDate.png

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (3,697)