You are here

public static function TimestampHelper::timestampToString in Node expire 7.2

Converts timestamp to string.

1 call to TimestampHelper::timestampToString()
TimestampUtils::timestampToStr in src/Module/Utils/TimestampUtils.php
Converts timestamp int to date string.

File

src/Module/CommonExpire/Conversion/TimestampHelper.php, line 20
TimestampHelper class.

Class

TimestampHelper
TimestampHelper class.

Namespace

Drupal\node_expire\Module\CommonExpire\Conversion

Code

public static function timestampToString($format, $timestamp) {
  $dt = new \DateTime();
  $dt
    ->setTimestamp($timestamp);
  $str = $dt
    ->format($format);
  if (!$str) {
    throw new ExpireException(t('Wrong timestamp or format.'));
  }
  return $str;
}