function socialcalc_import_date in Sheetnode 5
Same name and namespace in other branches
- 6 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
1 call to socialcalc_import_date()
File
- ./
socialcalc.inc, line 803 - 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;
}