function interval_php_interval in Interval Field 7
Returns a PHP date/time string for a given interval.
Parameters
array $item: An array of values for the interval item consisting of:
- interval: the interval (int)
- period: the interval period
array $interval: An array of interval properties.
Return value
string The PHP date/time string.
See also
interval_get_intervals
2 calls to interval_php_interval()
- interval_apply_interval in ./
interval.module - Applies the interval values to a given date
- interval_field_formatter_view in ./
interval.module - Implements hook_field_formatter_view().
File
- ./
interval.module, line 492 - Defines an interval field @copyright Copyright(c) 2011 Rowlands Group @license GPL v2+ http://www.fsf.org/licensing/licenses/gpl.html @author Lee Rowlands leerowlands at rowlandsgroup dot com
Code
function interval_php_interval($item, $interval = NULL) {
if (!isset($interval)) {
$intervals = interval_get_intervals();
$interval = $intervals[$item['period']];
}
$value = $item['interval'] * $interval['multiplier'];
$datetime = $value . ' ' . $interval['php'];
return $datetime;
}