You are here

public function weather_handler_date::get_value in Weather 7.2

Same name and namespace in other branches
  1. 7.3 views_handlers/weather_handler_date.inc \weather_handler_date::get_value()

Calculate UNIX timestamp of date.

Overrides views_handler_field::get_value

File

views_handlers/weather_handler_date.inc, line 43
Views handler for weather module.

Class

weather_handler_date
Field handler to .

Code

public function get_value($values, $field = NULL) {
  if (is_null($values->{$this->field_alias})) {
    return;
  }
  $value = parent::get_value($values, $field);
  $utc_offset = parent::get_value($values, 'utc_offset');
  $sign = $utc_offset < 0 ? '-' : '+';
  $utc_offset = abs($utc_offset);
  $hours = sprintf("%02d", floor($utc_offset / 60));
  $minutes = sprintf("%02d", $utc_offset % 60);
  return strtotime($value . ' ' . $sign . $hours . ':' . $minutes);
}