cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Joenathan
Frequent Visitor

Formating SQL Time(0)

I'm getting the following error when attempting to use the FormatDateTime function with MSSQL Time(0) data format: the value provided for date time string 'PT15H44M' was not valid. The datetime string must match ISO 8601 format.'

 

I found the following solution for Power Apps but not sure how to use the solution in Power Automate

 

With( 
    Match( "PT7H30M", "PT(?:(?<hours>\d+)H)?(?:(?<minutes>\d+)M)?(?:(?<seconds>\d+)S)?" ),
    Time( Value( hours ), Value( minutes ), Value( seconds ) )
)

 

Any help would be much appreciated. 


Thank you

1 REPLY 1
v-LilyW-msft
Community Support
Community Support

Hi @Joenathan 

Please refer to the following test and to see if it helps.

vLilyWmsft_0-1647844178042.png

Add Compose action and rename to 'H'

first(split(last(split(outputs('Compose'),'T')),'H'))

vLilyWmsft_1-1647844193165.png

Add Compose action and rename to 'M'

first(split(last(split(outputs('Compose'),'H')),'M'))

vLilyWmsft_2-1647844218272.png

concat(outputs('H'),':',outputs('M'))

vLilyWmsft_3-1647844242902.png

formatDateTime(outputs('Compose_2'),'HH:mm')

vLilyWmsft_4-1647844272244.png

Results:

vLilyWmsft_5-1647844314976.png

Hope the content above may help you.

Best Regards

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,775)