====== pears.NetStringToTimestamp ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."NetStringToTimestamp"( in "sDateTime" char(25) ) returns timestamp begin set "sDateTime" = "trim"("sDateTime"); -- remove trailing and leading white space if "sDateTime" regexp '^\\d{4}\\-\\d{2}\\-\\d{2}(T|\\040)\\d{2}:\\d{2}($|Z$|\\+00:00$|:\\d{2}($|Z$|\\+00:00$))' then -- check to make sure it is formatted correctly set "sDateTime" = "REPLACE"("sDateTime",'T',' '); set "sDateTime" = "REPLACE"("sDateTime",'Z',''); set "sDateTime" = "REPLACE"("sDateTime",'+00:00',''); return convert(timestamp,"sDateTime",120) else return null end if end /* DOC 2018-08-03 ET create function which to change ISO string to timestamp. ISO string may include or not include seconds. */