You are here

function opening_hours_format_time in Opening hours 7

Same name and namespace in other branches
  1. 6 opening_hours.module \opening_hours_format_time()

Format a time value from the database, stripping the seconds.

1 call to opening_hours_format_time()
opening_hours_instance_prepare in ./opening_hours.module
Prepare an instance object loaded from the database for use with Backbone.

File

./opening_hours.module, line 376
Opening hours module.

Code

function opening_hours_format_time($time) {
  $matches = array();
  $time_formatted = NULL;
  preg_match('/^([0-2]?\\d):([0-5]?\\d)/', $time, $matches);
  if (!empty($matches[1]) && !empty($matches[2])) {
    $time_formatted = $matches[1] . ':' . $matches[2];
  }
  drupal_alter('opening_hours_format_time', $time_formatted);
  return $time_formatted;
}