cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
burgett94 Resolver II
Resolver II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

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
Super User
Super User

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

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.

burgett94 Resolver II
Resolver II

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

Super User
Super User

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
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,099)