You are here

function scheduler_get_date_only_format in Scheduler 7

Returns the date part of a date format.

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

Parameters

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

Return value

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

1 call to scheduler_get_date_only_format()
scheduler_admin_submit in ./scheduler.admin.inc
Form submission handler for scheduler_admin().

File

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

Code

function scheduler_get_date_only_format($format) {
  $date_start = strcspn($format, SCHEDULER_DATE_LETTERS);
  $date_length = strlen($format) - strcspn(strrev($format), SCHEDULER_DATE_LETTERS) - $date_start;
  return substr($format, $date_start, $date_length);
}