Gdat$

gdat$ returns a date from a day, month, and year.

Syntax

 gdat$(EXPR_DAY,EXPR_MONTH,EXPR_YEAR)

Examples

 # Let's compute the date in 6 monthDATE_6M = gdat$(day(date$), month(date$)+6, year(date$))# The formula is equivalent to :DATE_6M = addmonth(date$,6)# Let's find the last day of the previous monthLAST_MONTH_DAY = gdat$(0, month(date$), year(date$))# The formula is equivalent to :LAST_MONTH_DAY = eomonth(gdat$(1, month(date$)-1, year(date$)))# How many days in the current month?DAYS_NB = day(gdat$(0, month(date$)+1, year(date$)))# The formula is equivalent to :DAYS_NB = day(eomonth(date$))

Description

gdat$ calculates a date from its three components. If a month out of the [1,12] range is given, the month is recalculated on modulo 12 basis and the year is adjusted accordingly. The same adjustment is done for days if a negative day number or a number over the maximum day number of the month is given.

If the year is two digits, the adxdcs value is used as a pivot value to define a century. The only exception is gdat$(0,0,0), which returns the null date.

The result has a Date type.

Associated errors

Error codeDescription
10At least one of the arguments is not numeric.
56Invalid date.

See also

day, day$, month, month$, year, dayn, nday, date$, datesyst, Date, eomonth, adxdcs.