function rules_gmstrtotime in Rules 6
Convert a time string to a GMT (UTC) unix timestamp
3 calls to rules_gmstrtotime()
- rules_data_type_date::check_value in rules/
modules/ rules.rules.inc - Checks the value of your data type. E.g. the number data type uses this to make sure the value is a number.
- rules_scheduler_delete_task in rules_scheduler/
rules_scheduler.admin.inc - Confirmation form for deleting single tasks.
- rules_scheduler_views_handler_datetime::render in rules_scheduler/
includes/ rules_scheduler_views_handler_datetime.inc
File
- rules/
rules.module, line 1077 - Rules engine module
Code
function rules_gmstrtotime($time) {
if (preg_match(RULES_DATE_REGEX_LOOSE, $time)) {
// Append 'UTC' to indicate that the time string is in GMT/UTC.
return strtotime($time . ' UTC');
}
// If the time string is not in plain old date format (e.g. 'now', '+1 day'
// etc.), we need to convert it first.
$value = strtotime($time);
$date = gmdate('Y-m-d H:i:s', $value);
return strtotime($date . ' UTC');
}