You are here

function date_getdate in Date 6

Same name and namespace in other branches
  1. 5.2 date_php4/date_php4.inc \date_getdate()
  2. 5 date.inc \date_getdate()
  3. 6.2 date_php4/date_php4.inc \date_getdate()

Returns an array with date info.

Parameters

$timestamp: A unix timestamp.

$is_gmt: Whether the timestamp is a GMT date that should not have a timezone conversion applied.

$test: Whether the date functions are being tested, used to force the low level function even for current dates.

1 call to date_getdate()
date_gmgetdate in date_php4/date_php4.inc
Like date_getdate with no GMT conversion.

File

date_php4/date_php4.inc, line 821

Code

function date_getdate($timestamp = false, $is_gmt = false, $test = true) {
  if ($timestamp === false) {
    return getdate();
  }

  // Check if test or number in 32-bit signed range
  // Below PHP 5.2 in windows, must be positive integer
  if (!$test && abs($timestamp) <= 0x7fffffff) {
    if ($timestamp >= 0) {
      $array = (array) @getdate($timestamp);

      // Make the array match our custom granularity array.
      $array['month_name'] = $array['month'];
      $array['month'] = $array['mon'];
      $array['day'] = $array['mday'];
      $array['hour'] = $array['hours'];
      $array['minute'] = $array['minutes'];
      $array['second'] = $array['seconds'];
      unset($array['mon'], $array['mday'], $array['hours'], $array['minutes'], $array['seconds']);
    }
  }
  include_once './' . drupal_get_path('module', 'date_php4') . '/date_php4_lib.inc';
  return _date_getdate($timestamp, $is_gmt);
}