function socialcalc_import_date in Sheetnode 6
Same name and namespace in other branches
- 5 socialcalc.inc \socialcalc_import_date()
- 7.2 socialcalc.inc \socialcalc_import_date()
- 7 socialcalc.inc \socialcalc_import_date()
Convert a date from PHP to SocialCalc date/time value
Parameters
mixed $dateValue 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_handler_field_date::render in views/
sheetnode_handler_field_date.inc - theme_sheetnode_formatter_socialcalc_date in ./
sheetnode.module - Theme function for SocialCalc date formatter.
File
- ./
socialcalc.inc, line 853 - SocialCalc manipulation functions Translated from socialcalc-3.js and companion files
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;
}