from decimal to time

0
is is possible to pass a decimal value to a time value? or how can I create a time value with a decimal?   I’m currently doing a mathematical operation between two time values and the result is a decimal and I need to convert it to minutes and seconds
asked
3 answers
0

Hi,

 

I suggest to use secondBetweens. Create a new variable and use  this: formatDateTime(addSeconds([%BeginOfCurrentDay%], round($Seconds)), 'mm:ss')

 

$Seconds is the result of your secondBetweens function. You will see the below.

 

 

Hope it helps.

answered
1

Hi Constanza,

 

There is another recent forum post about a related question here: https://forum.mendix.com/link/space/studio-pro/questions/122709

 

I believe the answer posted by Jan Conrad on that forum post is the most complete answer.  The other answers that suggest using the start of a given day and then calculating from there will be inaccurate if the time value is ever greater than 24 hours or if you are only looking at minutes it will fail if the time value is greater than 60 minutes.

 

For example using ‘mm:ss’ in a format date time function will display 01:11 if the time input is 61m 11s which could be problematic.

Hope this is helpful

Danny

answered
0

How did you do the calculation? Because the between date function calls https://docs.mendix.com/refguide/between-date-function-calls/ already give a result in a time value. So minutesBetween reults in minutes etc. And then to transform the result in some other time value is simple.

Regards,

Ronald

 

answered