Share this page 

Get time information from the DBMSTag(s): Database


This technique is compatible with any ODBC driver.
  DECLARE dbinfo DYNAMIC CURSOR FOR SQLSA;
  ls_sql = "SELECT {fn curdate() }"
  // ls_sql = "select {fn curtime() }"
  // ls_sql = "SELECT {fn now() }"
  PREPARE SQLSA FROM :ls_sql USING SQLCA;

  OPEN DYNAMIC dbinfo;
  IF SQLCA.SQLCode > 0 THEN
       // erro handling
  END IF
  FETCH  dbinfo INTO :ls_date;
  CLOSE dbinfo;
  RETURN Date(left(ls_date, 10))