You are here

public static function TimestampUtils::timestampToStr in Node expire 7.2

Converts timestamp int to date string.

NODE_EXPIRE_NO_EXPIRE and '' are used as special values.

2 calls to TimestampUtils::timestampToStr()
TimestampUtils::dateDbToStr in src/Module/Utils/TimestampUtils.php
Convert timestamp int to date string.
TimestampUtils::dateStrFromCfgDefault in src/Module/Utils/TimestampUtils.php
Makes date string from default config value for node type.

File

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

Class

TimestampUtils
TimestampUtils class.

Namespace

Drupal\node_expire\Module\Utils

Code

public static function timestampToStr($date_in) {
  $date_inner = $date_in;
  if (empty($date_inner)) {
    $str = '';
  }
  elseif ($date_inner >= NODE_EXPIRE_NO_EXPIRE) {
    $str = '';
  }
  else {
    try {
      $format = ConfigHandler::getDateFormat();
      $str = TimestampHelper::timestampToString($format, $date_inner);
    } catch (\Exception $e) {
      $str = '';
    }
  }
  return $str;
}