You are here

function node_import_valid_date in Node import 5

Check if a date is valid and return the correct timestamp to use. Returns -1 if the date is not considered valid.

2 calls to node_import_valid_date()
event_node_import_prepare in supported/event.inc
Implementation of hook_node_import_prepare().
node_node_import_prepare in supported/node.inc
Implementation of hook_node_import_prepare().

File

./node_import.module, line 743
This modules provides a wizard at "administer >> content >> import" to import a CSV file with nodes.

Code

function node_import_valid_date($date) {

  //TODO: really check whether the date is valid!!
  if (empty($date)) {
    return -1;
  }
  if (is_numeric($date) && $date > -1) {
    return $date;
  }
  $time = strtotime($date);
  if ($time < 0 || !$time) {
    return -1;
  }
  return $time;
}