You are here

function date_days_in_year in Date 6

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. 7.3 date_api/date_api.module \date_days_in_year()
  4. 7 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:

string $type:

Return value

integer

1 call to date_days_in_year()
date_difference in ./date_api.module
Compute difference between two days using a given measure.

File

./date_api.module, line 636
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, $type = DATE_OBJECT) {
  if (empty($date)) {
    $date = date_now();
    $type = DATE_OBJECT;
  }
  $date = date_convert($date, $type, DATE_OBJECT);
  if (is_object($date)) {
    if (date_format($date, 'L')) {
      return 366;
    }
    else {
      return 365;
    }
  }
  return NULL;
}