You are here

public static function TimestampUtils::dateStrToDb in Node expire 7.2

Convert date string to timestamp int.

Parameters

string $date_in: String date representation for UI: not set, non-date string, date string.

object $ntype: Node expire configuration for particular node type.

Return value

int Timestamp (int) date representation for DB: timestamp int, NODE_EXPIRE_NO_EXPIRE as a special value.

1 call to TimestampUtils::dateStrToDb()
NodeHookHandler::doNodeUpdateInsert in src/Module/Hook/NodeHookHandler.php
Implements hook_node_update() and hook_node_insert().

File

src/Module/Utils/TimestampUtils.php, line 32
TimestampUtils class.

Class

TimestampUtils
TimestampUtils class.

Namespace

Drupal\node_expire\Module\Utils

Code

public static function dateStrToDb($date_in, $ntype) {
  if (!isset($date_in)) {
    $date_out = NODE_EXPIRE_NO_EXPIRE;
    return $date_out;
  }
  $date_inner = trim($date_in);
  $date_out = self::strToTimestamp($date_inner);
  return $date_out;
}