public static function TimestampHelper::stringToTimestamp in Node expire 7.2
Converts string to timestamp.
3 calls to TimestampHelper::stringToTimestamp()
- TimestampUtils::dateStrFromCfgDefault in src/
Module/ Utils/ TimestampUtils.php - Makes date string from default config value for node type.
- TimestampUtils::dateStrToCfgDefault in src/
Module/ Utils/ TimestampUtils.php - Converts date string to timestamp int.
- TimestampUtils::strToTimestamp in src/
Module/ Utils/ TimestampUtils.php - Converts date string to timestamp int.
File
- src/
Module/ CommonExpire/ Conversion/ TimestampHelper.php, line 33 - TimestampHelper class.
Class
- TimestampHelper
- TimestampHelper class.
Namespace
Drupal\node_expire\Module\CommonExpire\ConversionCode
public static function stringToTimestamp($format, $str) {
$dt = \DateTime::createFromFormat('!' . $format, $str);
if (!$dt) {
throw new ExpireException(t('Wrong datetime string.'));
}
$timestamp = $dt
->getTimestamp();
return $timestamp;
}