Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.numtotime ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."numtotime"( in "thenum" decimal(5,2) ) returns time begin declare "rv" time; declare "ss" char(5); declare "ii" smallint; declare "num1" decimal(5,2); declare "num2" decimal(5,2); set "num1" = "floor"("thenum"); set "num2" = "thenum"-"num1"; if "thenum" >= 24 or "thenum" < 0 then set "num1" = 23; set "num2" = .59 end if; if "num2" > .59 then set "num2" = .59 end if; set "thenum" = "num1"+"num2"; set "ss" = "thenum"; set "ii" = "locate"("ss",'.'); if "ii" = 0 then set "ss" = "ss"+':00' else if "ii" = 1 then set "ss" = '0' || "ss"; set "ii" = 2 end if; set "ss" = "left"("ss","ii"-1)+':'+"substr"("ss","ii"+1,2) end if; set "rv" = "ss"; return("rv") end </code> database/functions/pears_numtotime.txt Last modified: 2026/08/07 19:24by 127.0.0.1