You are here

function date_array2iso in Date 5

Date conversion functions

a variety of ways to convert values are provided arrays are in the format created by getdate() return false for anything that can't produce a valid year iso date may have a year only or year and month only unix dates must have at least a year month and day

these function return 'ERROR' instead of FALSE because of problems distinguishing between a valid 0 value and a FALSE value

3 calls to date_array2iso()
date_custom2iso in ./date.inc
date_selector_make_dbdate in ./date.inc
Construct a value to save to the database from the date selector
date_unset_granularity in ./date.inc
Unset undesired date part values.

File

./date.inc, line 1151
Date/time API functions

Code

function date_array2iso($array) {
  if (!date_is_valid($array, 'array')) {
    return 'ERROR';
  }
  return sprintf("%04d", intval($array['year'])) . '-' . sprintf("%02d", intval($array['mon'])) . '-' . sprintf("%02d", intval($array['mday'])) . 'T' . sprintf("%02d", intval($array['hours'])) . ':' . sprintf("%02d", intval($array['minutes'])) . ':' . sprintf("%02d", intval($array['seconds']));
}