I found this code to create a node programmatically. It creates the node but the "title" field is not populated.
$body_text = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.';
$node = new stdClass();
$node->type = 'flats';
node_object_prepare($node);
$node->title = 'Node Created on ' . date('c');
$node->language = 'en';
$node->body[$node->language][0]['value'] = $body_text;
$node->body[$node->language][0]['summary'] = text_summary($body_text);
$node->body[$node->language][0]['format'] = 'filtered_html';
$path = 'content/my-lipsum-' . date('YmdHis');
$node->path = array('alias' => $path);
node_save($node);
The machine name of my Title is "title_field", but using this neither works:
$node->title_field = 'Node Created on ' . date('c');