Hello
I try to create node:
...
$values['title'] = 'title';
$values['body']= 'body';
$values['name'] = "myname";
$values['status'] = 1;
drupal_execute('news_node_form', $values, $node);

it works. But i dont know how to insert creation date, i try:
$values['date']='2009-09-20 14:25:04 +0200';
or
$values['created'] =time()+ (7 * 24 * 60 * 60);
with different configuration and no success. Drupal always insert current creation date.
plz help

Comments

sapark’s picture

maybe 2007-03-03T00:00:00, that is the date format for cck date if I remember correctly.

have you tried the devel module to see sample format of the field?

mpaler’s picture

It can be done. You need to do some massaging of the $form_state['values'] just before you run drupal_execute in uc_order_node_create. Here's how I got it going (for a single date field):

$date = date('m/d/Y', strtotime($form_state['values']['field_date'][0]['value']));
$form_state['values']['field_date'][0] = array(
        'value' => array(
          'date' => $date,
          'time' => '00:00',
        ),
        'value2' => array(
          'date' => $date,
          'time' => '00:00',
        ),
      );
drupal_execute($form_id, $form_state, $node);