You are here

public function Time::getTimestamp in Time Field For Drupal 8.x / 9.x 8

Same name and namespace in other branches
  1. 2.x src/Time.php \Drupal\time_field\Time::getTimestamp()

Number of seconds passed through midnight.

Return value

int Number of seconds passed through midnight

3 calls to Time::getTimestamp()
Time::format in src/Time.php
Format Time.
Time::formatForWidget in src/Time.php
Format for widget.
Time::on in src/Time.php
DateTime with attached time to it.

File

src/Time.php, line 114

Class

Time
Time class represents time of day.

Namespace

Drupal\time_field

Code

public function getTimestamp() {
  $value = $this->hour * 60 * 60;
  $value += $this->minute * 60;
  $value += $this->second;
  return $value;
}