Date functions
Date functions are provided to manipulate FastStats date fields.
Today¶
Returns today’s date shifted by n days.
For example:
Today(0)is today’s dateToday(1)is tomorrowToday(-1)is yesterdayToday(-7)is one week ago
AgeDays¶
Age of date in days relative to today.
For example, if today is 30th May 2007 and date1 is 20th May 2007, AgeDays(date1) = 10.
AgeQuarters¶
Age of date in 3 calendar month periods relative to today
For example, if today is 12 October 2011 and date1 = 05 January 2011, AgeQuarters (date1) = 3.
AgeWeeks¶
Age of date in whole weeks relative to today
For example, if today is 30 May 2007 and date1 is 20 May 2007, AgeWeeks(date1) = 1.
AgeMonths¶
Age of date in months relative to today
For example, if today is 30 May 2007 and date1 is 20 May 2006, AgeMonths (date1) = 12.
AgeYears¶
Age of date in years relative to today
For example, if today is 30 May 2007 and date1 = 20 May 2005, AgeYears (date1) = 2.
DateDay¶
Day of date 1.. 31
DateWeek¶
Week of date 1..53
DateMonth¶
Month of date 1=Jan, 2=Feb, … 12=Dec
DateQuarter¶
Quarter of date 1=Q1, 2=Q2, 3=Q3, 4=Q4
DateYear¶
Year of date e.g. 2005
DayOfWeek¶
Day of date 1=Monday, 2=Tuesday, … 7=Sunday
Date2Days¶
The number of days since 0000
DateDiff¶
Calculates [Date] - [Date] measured in the specified units (years, quarters, months, weeks, days).
Units specifier is optional. If missing, the default units are days. If only one date is specified, the given date is compared to today.
For example:
-
DateDiff([DepartureDate],[Booking Date],”Days”)is the number of days between departure and booking. -
DateDiff([DepartureDate],20051231,”Days”)is the number of days between departure and 31 Dec 2005. -
DateDiff([DepartureDate],Today(0),”Days”)is the number of days until departure. -
DateDiff([DepartureDate],[Booking Date],”Weeks”)is the number of weeks between departure and booking.
The zero band extends in both a forward and backward direction from the reference date. An optional final parameter can be set to 1 to return missing value if the first date is after the second date. This ensures that results are only returned when there is a positive value, which corresponds to when the date parameters are in chronological order.
For example:
MakeDate¶
Makes a constant date from numbers
For example:
The expression below returns the start of the year in which the booking was made.
DateShift¶
Shift a time by a number of units (years, quarters, months, weeks, days).
For example:
DateShift([BookingDate],30,”Days”)calculates 30 days after booking.DateShift([DepartureDate],-30,”Days”)calculates 30 days before departure.DateShift([DOB],18,"Years")calculates 18th birthday
DayOfYear¶
Calculates the day number in the year 1 .. 366
For example, the expression below equals 5.
BuildDate¶
The FastStats system build date shifted by n days.
For example:
BuildDate(0)= build dateBuildDate(-1)= day before build date
Legacy date functions¶
These are provided for backwards compatibility, but have been superceded by more useful date functions.
Day¶
Number of days from year 0000 to date.
Week¶
Number of weeks from year 0000 to date.
Month¶
Number of months from year 0000 to date.
Year¶
Number of years from year 0000 to date.
.png)