When editing an imported / existing table or creating a new table the MySQL data type 'datetime' is not available in the type list box of the form.

On inspection of the code we find the options for that list box are a hard coded subset of the schema API (according to the comments) with an addition or two.

I think it would be better to get the options from the schema API.

This in itself wont solve the missing 'datetime' because it's not there in Schema either but I'm willing to work on that. For the interim we could just extend the list we get from Schema.

Comments

jncruces’s picture

I solve the problem with two new definitions, datetime and numeric in data.module function data_get_fields_definitions:

    'datetime' => array(
      'type' => 'datetime',
      'not null' => FALSE,
    ),
    'numeric' => array(
      'type' => 'numeric',
      'not null' => FALSE,
    ),

Numeric is for decimal(10,2) that data not recognized it. And datetime works normal, at the moment.

Later i have to update includes/common.inc to repair the datetime format in the case of datetime and not timestamp, line 2013 i remplazed this:

	  $date_time = date_create('@' . $timestamp);

with this:

	if(is_numeric($timestamp)){		
	  $date_time = date_create('@' . $timestamp);
	}else{
		$date_time = date_create('@' . strtotime($timestamp));
	}

I hope this will help.

Regards

qqboy’s picture

Issue summary: View changes

goto admin/structure/data/edit/xx/views, then we can choose handler for timestamp-like field.