Hi there!
I think you’re running into issues because DATETIME_FORMAT() returns a string. You can convert the value to a number by wrapping it in the VALUE() formula.
Try this:
IF({Start Time (UTC)}, VALUE(DATETIME_FORMAT({Start Time (UTC)}, 'm'))/60)
You’ll also want to make sure your formula field is formatted as a number with decimals (after you set the formula), or else you’ll only return integers. Hope this helps!
EDIT: Just realized this only solves half of the problem. Will update with more!
Hi there!
I think you’re running into issues because DATETIME_FORMAT() returns a string. You can convert the value to a number by wrapping it in the VALUE() formula.
Try this:
IF({Start Time (UTC)}, VALUE(DATETIME_FORMAT({Start Time (UTC)}, 'm'))/60)
You’ll also want to make sure your formula field is formatted as a number with decimals (after you set the formula), or else you’ll only return integers. Hope this helps!
EDIT: Just realized this only solves half of the problem. Will update with more!
The following should yield the hours as well a decimal value for the minutes
IF({Start Time (UTC)}, SUM(VALUE(DATETIME_FORMAT({Start Time (UTC)}, 'h')), VALUE(DATETIME_FORMAT({Start Time (UTC)},'m'))/60))
Hi there!
I think you’re running into issues because DATETIME_FORMAT() returns a string. You can convert the value to a number by wrapping it in the VALUE() formula.
Try this:
IF({Start Time (UTC)}, VALUE(DATETIME_FORMAT({Start Time (UTC)}, 'm'))/60)
You’ll also want to make sure your formula field is formatted as a number with decimals (after you set the formula), or else you’ll only return integers. Hope this helps!
EDIT: Just realized this only solves half of the problem. Will update with more!
This is great, thank you - VALUE
was what I needed.
This is the formula I ended up with :
DATETIME_FORMAT({Start time (UTC)},'H') & IF(VALUE(DATETIME_FORMAT({Start time (UTC)},'m'))/60=0,'', SUBSTITUTE(VALUE(DATETIME_FORMAT({Start time (UTC)},'m'))/60&"",'0',''))
You can also directly get the numbers of hours and minutes (without having to use DATETIME_FORMAT
or VALUE
, by using the HOUR()
and
MINUTE()
functions. They are documented in the formula field reference.
HOUR({Start time (UTC)} + (MINUTE({Start time (UTC)}) / 60)
This will result in a number (instead of a string) and you can use field formatting to adjust the number of decimal places.