Dealing with dates and time
In Game Maker there are a number of functions to deal with dates and time.
A date-time combination is stored in a real number. The integral part of a date-time
value is the number of days that have passed since 12/30/1899. The fractional part
of the date-time value is fraction of a 24 hour day that has elapsed.
The following functions exist:
date_current_datetime()
Returns the date-time value that corresponds to the current moment.
date_current_date()
Returns the date-time value that corresponds to the current date only (ignoring the time).
date_current_time()
Returns the date-time value that corresponds to the current time only (ignoring the date).
date_create_datetime(year,month,day,hour,minute,second)
Creates a date-time value corresponding to the indicated date and time.
date_create_date(year,month,day)
Creates a date-time value corresponding to the indicated date.
date_create_time(hour,minute,second)
Creates a date-time value corresponding to the indicated time.
date_valid_datetime(year,month,day,hour,minute,second)
Returns whether the indicated date and time are valid.
date_valid_date(year,month,day)
Returns whether the indicated date is valid.
date_valid_time(hour,minute,second)
Returns whether the indicated time is valid.
date_inc_year(date,amount)
Returns a new date that is amount years after the indicated date.
amount must be an integer number.
date_inc_month(date,amount)
Returns a new date that is amount months after the indicated date.
amount must be an integer number.
date_inc_week(date,amount)
Returns a new date that is amount weeks after the indicated date.
amount must be an integer number.
date_inc_day(date,amount)
Returns a new date that is amount days after the indicated date.
amount must be an integer number.
date_inc_hour(date,amount)
Returns a new date that is amount hours after the indicated date.
amount must be an integer number.
date_inc_minute(date,amount)
Returns a new date that is amount minutes after the indicated date.
amount must be an integer number.
date_inc_second(date,amount)
Returns a new date that is amount seconds after the indicated date.
amount must be an integer number.
date_get_year(date)
Returns the year corresponding to the date.
date_get_month(date)
Returns the month corresponding to the date.
date_get_week(date)
Returns the week of the year corresponding to the date.
date_get_day(date)
Returns the day of the month corresponding to the date.
date_get_hour(date)
Returns the hour corresponding to the date.
date_get_minute(date)
Returns the minute corresponding to the date.
date_get_second(date)
Returns the second corresponding to the date.
date_get_weekday(date)
Returns the day of the week corresponding to the date.
date_get_day_of_year(date)
Returns the day of the year corresponding to the date.
date_get_hour_of_year(date)
Returns the hour of the year corresponding to the date.
date_get_minute_of_year(date)
Returns the minute of the year corresponding to the date.
date_get_second_of_year(date)
Returns the second of the year corresponding to the date.
date_year_span(date1,date2)
Returns the number of years between the two dates.
It reports incomplete years as a fraction.
date_month_span(date1,date2)
Returns the number of months between the two dates.
It reports incomplete months as a fraction.
date_week_span(date1,date2)
Returns the number of weeks between the two dates.
It reports incomplete weeks as a fraction.
date_day_span(date1,date2)
Returns the number of days between the two dates.
It reports incomplete days as a fraction.
date_hour_span(date1,date2)
Returns the number of hours between the two dates.
It reports incomplete hours as a fraction.
date_minute_span(date1,date2)
Returns the number of minutes between the two dates.
It reports incomplete minutes as a fraction.
date_second_span(date1,date2)
Returns the number of seconds between the two dates.
It reports incomplete seconds as a fraction.
date_compare_datetime(date1,date2)
Compares the two date-time values. Returns -1, 0, or 1 depending on whether the first is
smaller, equal, or larger than the second value.
date_compare_date(date1,date2)
Compares the two date-time values only taking the date part into account.
Returns -1, 0, or 1 depending on whether the first is smaller, equal, or
larger than the second value.
date_compare_time(date1,date2)
Compares the two date-time values only taking the time part into account.
Returns -1, 0, or 1 depending on whether the first is smaller, equal, or
larger than the second value.
date_date_of(date)
Returns the date part of the indicated date-time value,
setting the time part to 0.
date_time_of(date)
Returns the time part of the indicated date-time value,
setting the date part to 0.
date_datetime_string(date)
Returns a string indicating the given date and time in the
default format for the system.
date_date_string(date)
Returns a string indicating the given date in the default format
for the system.
date_time_string(date)
Returns a string indicating the given time in the default format
for the system.
date_days_in_month(date)
Returns the number of days in the month indicated by the date-time value.
date_days_in_year(date)
Returns the number of days in the year indicated by the date-time value.
date_leap_year(date)
Returns whether the year indicated by the date-time value is a leap year.
date_is_today(date)
Returns whether the indicated date-time value is on today.