1.20.x database.inc public DatabaseConnection_mysql::dateFieldSql($field, $date_type = DATE_UNIX)

Overrides DatabaseConnection::dateFieldSql

File

drivers/database_mysql/database.inc, line 646
Database interface code for MySQL database servers.

Class

DatabaseConnection_mysql

Code

public function dateFieldSql($field, $date_type = DATE_UNIX) {
  switch ($date_type) {
    case 'int':
      watchdog('database', 'Date field type "int" has been deprecated, use DATE_UNIX instead.', array(), WATCHDOG_DEPRECATED);
    case DATE_UNIX:
      $field = "FROM_UNIXTIME($field)";
      break;

    case DATE_ISO:
      $field = "STR_TO_DATE($field, '%Y-%m-%dT%T')";
      break;

    case DATE_DATETIME:
      break;
  }

  return $field;
}