# How to calculate a duration?

Hi everyone !

FIRST : in the row “Date”, I wrote UTCNOW because I want to have a date+hour (MM/DD/YYYY HH:MM:SS)
Is it ok ?

SECOND : in the row “Calcul du Δt”, I want to calculate “Date” (row n) - "Date (row n-1)

Unfortunately, after many trials, I don’ t succed to program it…

Thank you a lot in advance and have a good day !

No. The column type should be DateTime. Also, UTCNOW() transforms time using the universal offset. I don’t think that is what you want here. Use NOW() after you have updated the column type.

After making those two changes try again and let us know if it works.

1 Like

I’m making an app which can follow the status of the maintenances interventions during a day.
I have to make some pick up with differents informations like “Numéro de mesure”, “Date”, etc…
Furthermore, I want to get the time between two pick ups with the column “Durée du Δt”.

• RED 1 :

I modified the column “Date” as you said.

But unfortunately it display the date with format “DD/MM/YYYY” and not with format “DD/MM/YYYY HH:MM:SS”.

• RED 2 :

The column “Durée du Δt” is a duration because it is a difference between the date at the row n and the date at the row n-1 “(DD/MM/YYYY HH:MM:SS)n - (DD/MM/YYYY HH:MM:SS)n-1”. By this way it should give a duration of some hours (because all the mesure will be taken the same day).

I hope you understand better what I want to do and you can help me on that topic…

Have a good day !

Make sure your column definition looks like this below. If it does, are you assigning a value with an expression? If that is the case, please post here that expression so we can look at it.

Please show the expression you are using to get this duration.

1 Like

Hi !

As you can see on the picture, the column type is DateTime but, on the app, nothing happen…the value still “jj/mm/aaaa --:–:–”.
I don’t understand why it doens’t work…

Thank you for your help !

I think you don’t have to set the formula. just leave it blank

1 Like