Date class

The following sections explain each method of the class.

now


public static int now ( string $timezone = TIMEZONE)

Return current UNIX timestamp back under consideration of the given time zone.

Parameter list
timezone

The time zone from the UNIX timestamp is to be calculated. By default, the time zone is omitted from the constants.php.


get_timestamp_by_date


public static int get_timestamp_by_date ( string $date)

Returns the UNIX timestamp of the entered date, taking into account the default time zone that is defined in the constants.php.

Parameter list
date

The date to be converted in the UNIX timestamp. Allowed are all popular formats.


get_date_by_timestamp


public static String get_date_by_timestamp ( int $timestamp, string $format = 'Y-m-d')

Converts a UNIX timestamp into a date, taking into account the default time zone that is defined in the constants.php.

Parameter list
timestamp

The UNIX timestamp to be converted in the date.

format

The format of the date. By default Y-m-d (year-month-day).


get_easter_day_by_year


public static String|Int get_easter_day_by_year ( int $year, boolean $inTimestamp = false)

Returns the beginning of Easter of a given year, taking into account the current time zone that is defined in the constants.php.

Parameter list
year

The year of where the beginning of Easter back to be given.

inTimestamp

When the time is to be returned as a UNIX timestamp, you have here true state, otherwise it returns a date string in the format Y-m-d. Default false


get_nation_holidays_by_year


public static Array get_nation_holidays_by_year ( int $year, string $nation = self::NATION_GERMANY)

Are all holiday of a particular nation in a given year as associative array. Available following Nations are constants:

  • NATION_GERMANY
  • NATION_AUSTRIAN
  • NATION_DENMARK
  • NATION_FRENCH
  • NATION_ITALIAN
  • NATION_NORWEGIAN
  • NATION_POLISH
  • NATION_SWEDISH

Parameter list
year

The year of the celebrations of a nation are to be returned.

nation

The nation of the celebrations of a particular year shall be returned. Here are 8 nations available. This list is constantly in expansion and will soon include more nation. By default NATION_GERMANY


is_year_leap_year


public static Boolean is_year_leap_year ( int $year)

Controls whether the Transferred year is a leap year. If the year is a leap year, one comes true otherwise a false return.

Parameter list
year

The year to be checked whether it is a leap year or not.


get_days_in_month


public static Integer get_days_in_month ( int $month, int $year = 0, int $particular_calendar = CAL_GREGORIAN)

Returns the number of days in a month back in a given year from a specific calendar. Allows the following calendar constants:

  • CAL_GREGORIAN - Gregorian Calendar
  • CAL_JULIAN - Julian calendar
  • CAL_JEWISH - Jewish Calendar
  • CAL_FRENCH - Calendar of the French Revolution

Parameter list
month

The month of the number of possible days to be returned.

year

The year that is specified taking into account the monthly period. If none is specified or the value 0 is returned, the month length of the current year.

particular_calendar

By specifying information are returned from a particular calendar. By default CAL_GREGORIAN set.