# date_func.h File Reference

Functions related to dates. More...

`#include "date_type.h"`

Go to the source code of this file.

## Functions
void | SetDate (Date date)
void | ConvertDateToYMD (Date date, YearMonthDay *ymd)
| Converts a Date to a Year, Month & Day.
Date | ConvertYMDToDate (Year year, Month month, Day day)
| Converts a tupe of Year, Month and Day to a Date.
static bool | IsLeapYear (Year yr)
## Variables
Year | _cur_year
| Current year, starting at 0.
Month | _cur_month
| Current month (0..11).
Date | _date
| Current date in days (day counter).
DateFract | _date_fract

## Detailed Description

Functions related to dates.

Definition in file date_func.h.

## Function Documentation

void ConvertDateToYMD | ( | Date | date,
|  | YearMonthDay * | ymd |
| ) |  |  |

Converts a Date to a Year, Month & Day.

Parameters:

  | date | the date to convert from
  | ymd | the year, month and day to write to

Definition at line 79 of file date.cpp.

References YearMonthDay::day, DAYS_IN_LEAP_YEAR, DAYS_IN_YEAR, YearMonthDay::month, and YearMonthDay::year.

Referenced by ClickChangeDateCheat(), DrawVehiclePurchaseInfo(), AIDate::GetDayOfMonth(), GetGlobalVariable(), AIDate::GetMonth(), GetSnowLine(), and AIDate::GetYear().

Date ConvertYMDToDate | ( | Year | year,
|  | Month | month,
|  | Day | day |
| ) |  |  |

Converts a tupe of Year, Month and Day to a Date.

Parameters:

  | year | is a number between 0..MAX_YEAR
  | month | is a number between 0..11
  | day | is a number between 1..31

Definition at line 135 of file date.cpp.

References DAYS_IN_YEAR.

Referenced by ClickChangeDateCheat(), FixTTOEngines(), GenerateWorld(), AIDate::GetDate(), and GetGlobalVariable().