You are here

function scheduler_get_time_only_format in Scheduler 7

Returns the time part of a date format.

For example, when given the string 'Y-m-d H:s:i' it will return 'H:s:i'.

Parameters

string $format: A date format compatible with the PHP date() function.

Return value

string The time part of the date format, or an empty string if it does not contain a time part.

2 calls to scheduler_get_time_only_format()
scheduler_admin_submit in ./scheduler.admin.inc
Form submission handler for scheduler_admin().
scheduler_admin_validate in ./scheduler.admin.inc
Form validation handler for scheduler_admin().

File

./scheduler.admin.inc, line 222
Administration forms for the Scheduler module.

Code

function scheduler_get_time_only_format($format) {
  $time_start = strcspn($format, SCHEDULER_TIME_LETTERS);
  $time_length = strlen($format) - strcspn(strrev($format), SCHEDULER_TIME_LETTERS) - $time_start;
  return substr($format, $time_start, $time_length);
}