You are here

function date_days_in_year in Date 7

Same name and namespace in other branches
  1. 5.2 date_api.module \date_days_in_year()
  2. 6.2 date_api.module \date_days_in_year()
  3. 6 date_api.module \date_days_in_year()
  4. 7.3 date_api/date_api.module \date_days_in_year()
  5. 7.2 date_api/date_api.module \date_days_in_year()

Identify the number of days in a year for a date.

Parameters

mixed $date:

Return value

integer

2 calls to date_days_in_year()
DateAPITestCase::testDateAPI in tests/date_api.test
DateObject::difference in date_api/date_api.module
Compute difference between two days using a given measure.

File

date_api/date_api.module, line 1342
This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.

Code

function date_days_in_year($date = NULL) {
  if (empty($date)) {
    $date = date_now();
  }
  elseif (!is_object($date)) {
    $date = new DateObject($date);
  }
  if (is_object($date)) {
    if ($date
      ->format('L')) {
      return 366;
    }
    else {
      return 365;
    }
  }
  return NULL;
}