Transforming minutes in make.com in JSON

45 views Asked by At

I have a problem with transforming minutes in make.com when I send JSON to wordpress with webhook. The information i get is in format "HH:MM" and it looks like this: 18:0 instead of 18:00, but when it comes to hours not rounded like 12:35 it gives proper minutes. I use code from make.com:

{{floor(1.seconds / 3600)}}:{{floor((1.seconds % 3600) / 60)}}:{{((1.seconds % 3600) % 60)}}

but result I have is like this: enter image description here but I need like: 18:00,

I dont know how to change it so that my JSON will have proper time when it is double 00.

Im transforming seconds to hours and minutes (86400 ( less than a day ).

Pleas help me.

Changing time to show double digits when there is 0.

1

There are 1 answers

0
brett_IOA On

I believe you would need to add in conditional logic to check if the hour or minute is greater than 9. If it is greater than 9, you will need to concatenate the string "0" with the value that is less than 9.

Here is an example:

{{floor(5.seconds / 3600)}}:{{if(floor((5.seconds % 3600) / 60) > 9; floor((5.seconds % 3600) / 60); toString(0) + toString(floor((5.seconds % 3600) / 60)))}}:{{if(((5.seconds % 3600) % 60) > 9; ((5.seconds % 3600) % 60); toString(0) + toString(((5.seconds % 3600) % 60)))}}