function date_fuzzy_stamp in Date 5
Create a valid timestamp that can be used for date formatting even if only partial date info is available, i.e. for an iso date with month and year only
1 call to date_fuzzy_stamp()
- date_show_date in ./
date.inc - A function to display formatted output for the date object
File
- ./
date.inc, line 512 - Date/time API functions
Code
function date_fuzzy_stamp($datetype) {
if ($datetype->timestamp) {
return $datetype->timestamp;
}
else {
return date_gmmktime(array(
'year' => $datetype->parts['year'] ? $datetype->parts['year'] : date('Y'),
'mon' => $datetype->parts['mon'] ? $datetype->parts['mon'] : 1,
'mday' => $datetype->parts['mday'] ? $datetype->parts['mday'] : 1,
'hours' => $datetype->parts['hours'] ? $datetype->parts['hours'] : 0,
'minutes' => $datetype->parts['minutes'] ? $datetype->parts['minutes'] : 0,
'seconds' => $datetype->parts['seconds'] ? $datetype->parts['seconds'] : 0,
));
}
}