Community & Support

Programmatically create any node type using drupal_execute

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

maybe 007-03-03T00:00:00,

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?

nobody click here