eatonphil
eatonphil

Reputation: 13702

Caché SQL - Convert Minute format to Hours

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!

Upvotes: 0

Views: 211

Answers (1)

psr
psr

Reputation: 2900

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.

Upvotes: 1

Related Questions