function date_make_date in Date 5
Same name and namespace in other branches
- 5.2 date_api.module \date_make_date()
 - 6.2 date_api.module \date_make_date()
 - 6 date_api.module \date_make_date()
 
Function to create a date object
All creation, manipulation, and display of the date is done using this date object
Parameters
$value - the date/time value to set: @param $timezone - 'GMT', 'none', or timezone name - the timezone of this value @param $type - db or local, the part of the date object to set @param $format - DATE_UNIX or DATE_ISO, the format of the provided value @return - the date object
15 calls to date_make_date()
- date_data_integrity in ./
date.install  - Progressive update of date information, integrity checking of all date values.
 - date_field in ./
date.module  - Implementation of hook_field().
 - date_field_object in ./
date.module  - Use the Date API to get an object representation of a date field
 - date_ical_date in ./
date_api_ical.inc  - Adjust ical date to appropriate timezone and format it.
 - date_ical_parse_duration in ./
date_api_ical.inc  - Parse the duration of the event.
 
File
- ./
date.inc, line 200  - Date/time API functions
 
Code
function date_make_date($value = '', $timezone = 'GMT', $type = 'db', $format = DATE_ISO) {
  $date = new StdClass();
  $date->db = new StdClass();
  $date->db->timestamp = NULL;
  $date->db->iso = NULL;
  $date->db->parts = NULL;
  $date->local = new StdClass();
  $date->local->timestamp = NULL;
  $date->local->iso = NULL;
  $date->local->parts = NULL;
  $date->local->timezone = NULL;
  $date->local->offset = NULL;
  if (trim($value) == '') {
    return $date;
  }
  // if initialized with a date, go ahead and set that date up
  date_set_date($date, $value, $timezone, $type, $format);
  return $date;
}