/** * Converts a timestamp "ts" to a string that the database can understand. * * @param ts a timestamp in Unix date time format. * * @return timestamp string in database timestamp format */ function DBTimeStamp($ts, $isfld = false) { if (empty($ts) && $ts !== 0) { return 'null'; } if ($isfld) { return $ts; } if (is_object($ts)) { return $ts->format($this->fmtTimeStamp); } # strlen(14) allows YYYYMMDDHHMMSS format if (!is_string($ts) || is_numeric($ts) && strlen($ts) < 14) { return adodb_date($this->fmtTimeStamp, $ts); } if ($ts === 'null') { return $ts; } if ($this->isoDates && strlen($ts) !== 14) { $ts = _adodb_safedate($ts); return "'{$ts}'"; } $ts = ADOConnection::UnixTimeStamp($ts); return adodb_date($this->fmtTimeStamp, $ts); }
function DBDate($d, $isfld = false) { if (empty($d) && $d !== 0) { return 'null'; } if ($isfld) { $d = _adodb_safedate($d); return 'TO_DATE(' . $d . ",'" . $this->dateformat . "')"; } if (is_string($d)) { $d = ADORecordSet::UnixDate($d); } if (is_object($d)) { $ds = $d->format($this->fmtDate); } else { $ds = adodb_date($this->fmtDate, $d); } return "TO_DATE(" . $ds . ",'" . $this->dateformat . "')"; }