frontbase

Frontbase date formatting functions


I've searched all over and can't find any info in Frontbase documentation or, for that matter, SQL92-related docs...does Frontbase have functions equivalent to datepart/date_part, or date_format as found in other RDBMSes? I need to output a timestamp column as a formatted string, and the correct syntax for Frontbase eludes me.


Solution

  • There may be a better way to do it, but a combination of cast, extract and string concatenation gave me the desired result:

    SELECT CAST(EXTRACT(month FROM mytimestampcol) AS VARCHAR(2)) || '/' || CAST(EXTRACT(day FROM mytimestampcol) AS VARCHAR(2)) || '/' || CAST(EXTRACT(year FROM mytimestampcol) AS VARCHAR(4)) AS "Begin Date" FROM mytable
    

    Yields "mm/dd/yyy" formatting.

    One of many SQL92 function references: http://www.faircom.com/doc/sqlref/#12959.htm