You are here

private function DateTest::createTimestamp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Datetime/DateTest.php \Drupal\Tests\Core\Datetime\DateTest::createTimestamp()

Creates a UNIX timestamp given a date and time string in the format year-month-day hour:minute:seconds (e.g. 2013-12-11 10:09:08).

Parameters

string $dateTimeString: The formatted date and time string.

Return value

int The UNIX timestamp.

3 calls to DateTest::createTimestamp()
DateTest::providerTestFormatDiff in core/tests/Drupal/Tests/Core/Datetime/DateTest.php
Data provider for testformatDiff().
DateTest::testFormatTimeDiffSince in core/tests/Drupal/Tests/Core/Datetime/DateTest.php
Tests the formatTimeDiffSince method.
DateTest::testFormatTimeDiffUntil in core/tests/Drupal/Tests/Core/Datetime/DateTest.php
Tests the formatTimeDiffUntil method.

File

core/tests/Drupal/Tests/Core/Datetime/DateTest.php, line 397
Contains \Drupal\Tests\Core\Datetime\DateTest.

Class

DateTest
@coversDefaultClass \Drupal\Core\Datetime\DateFormatter @group Datetime

Namespace

Drupal\Tests\Core\Datetime

Code

private function createTimestamp($dateTimeString) {
  return \DateTime::createFromFormat('Y-m-d G:i:s', $dateTimeString)
    ->getTimestamp();
}