Drupal 7, Rules, Convert text to date and set a date field I've some string like "11/28/2012" and i want use to populate a date field in my nodes/entity. In rules i use "set a value", select the date field and add php code:

$mydate = field_get_items(($entity_type, $entity, 'field_textdate');

$value = date('m-d-Y', $mydate);

return $value; 

But when i execute the rules, i get
46.397 ms Unable to modify data "node:field-datone": Invalid data value given. Be sure it matches the required data type and format.
57.754 ms Unable to evaluate action data_set. 

How can i do?
field_get_items() returns an array of items – try strtotime('m-d-Y', $mydate[0]['value']);. Also, it looks like you have an extra ( on your field_get_items call: 

field_get_items((

I would recommend installing the devel module, then you can add this code anywhere you'd like and get the results printed in your messages area for quick debugging and to see what data is available to you and how it's nested:

$mydate = field_get_items($entity_type, $entity, 'field_textdate');
dpm($mydate);