public static function TimestampUtils::strToTimestamp in Node expire 7.2
Converts date string to timestamp int.
NODE_EXPIRE_NO_EXPIRE and '' are used as special values.
1 call to TimestampUtils::strToTimestamp()
- TimestampUtils::dateStrToDb in src/
Module/ Utils/ TimestampUtils.php - Convert date string to timestamp int.
File
- src/
Module/ Utils/ TimestampUtils.php, line 170 - TimestampUtils class.
Class
- TimestampUtils
- TimestampUtils class.
Namespace
Drupal\node_expire\Module\UtilsCode
public static function strToTimestamp($date_in) {
// Can be placed into exception. Leaved here for faster execution.
if (!isset($date_in)) {
$timestamp = NODE_EXPIRE_NO_EXPIRE;
return $timestamp;
}
$date_inner = trim($date_in);
try {
$format = ConfigHandler::getDateFormat();
$timestamp = TimestampHelper::stringToTimestamp($format, $date_inner);
} catch (\Exception $e) {
$timestamp = NODE_EXPIRE_NO_EXPIRE;
}
return $timestamp;
}