Caché SQL - Convert Minute format to Hours
-
29-06-2021 - |
Question
I am working with a table that already exists that has columns formatted in some sort of a minute format. It looks like it was meant to be hh:mm, but it is not quite. For instance, where it should be 03:00, it says 01:80 for 180 minutes. Or for 1:30 it states 00:90. How can I convert these columns to an hh:mm format? Any help would be great, I'm struggling! Thanks!
Solution
The following elegant code:
SELECT ((myField*100)+RIGHT(myField,2))/60
|| ':'
|| RIGHT('00'(((myField*100)+RIGHT(myField,2))#60),2)
From myTable
seems to work.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow