You are here

function date_date in Date 6

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

Return formatted date based on timestamp $timestamp.

Parameters

$format: the format to be used for the returned timestamp

$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.

2 calls to date_date()
DatePHP4LibTest::testPHP4DateLibrary in tests/date_test.test
date_gmdate in date_php4/date_php4.inc
Like date_date with no GMT conversion.

File

date_php4/date_php4.inc, line 866

Code

function date_date($format, $timestamp = false, $is_gmt = false, $test = true) {
  if ($timestamp === false) {
    return $is_gmt ? @gmdate($format) : @date($format);
  }
  if (!$test && abs($timestamp) <= 0x7fffffff) {

    // Below PHP 5.2 in windows, must be positive integer
    if ($timestamp >= 0) {
      return $is_gmt ? @gmdate($format, $timestamp) : @date($format, $timestamp);
    }
  }
  include_once './' . drupal_get_path('module', 'date_php4') . '/date_php4_lib.inc';
  return _date_date($format, $timestamp, $is_gmt);
}