function socialcalc_import_date in Sheetnode 7.2
Same name and namespace in other branches
- 5 socialcalc.inc \socialcalc_import_date()
- 6 socialcalc.inc \socialcalc_import_date()
- 7 socialcalc.inc \socialcalc_import_date()
Convert a date from PHP to SocialCalc date/time value.
Parameters
mixed $dateValueUnix: timestamp or PHP DateTime object Unix timestamp or PHP DateTime object
Return value
mixed SocialCalc date/time value or boolean False on failure
2 calls to socialcalc_import_date()
- sheetnode_field_formatter_view in ./
sheetnode.module - Implements hook_field_formatter_view().
- sheetnode_handler_field_date::render in views/
sheetnode_handler_field_date.inc - Render the sheetnode date handler.
File
- ./
socialcalc.inc, line 1124 - SocialCalc manipulation functions.
Code
function socialcalc_import_date($dateValue = 0) {
$saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$retValue = FALSE;
if (is_object($dateValue) && $dateValue instanceof DateTime) {
$retValue = socialcalc_import_date_explicit($dateValue
->format('Y'), $dateValue
->format('m'), $dateValue
->format('d'), $dateValue
->format('H'), $dateValue
->format('i'), $dateValue
->format('s'));
}
elseif (is_numeric($dateValue)) {
$retValue = socialcalc_import_date_explicit(date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue), date('H', $dateValue), date('i', $dateValue), date('s', $dateValue));
}
date_default_timezone_set($saveTimeZone);
return $retValue;
}