<< Click to Display Table of Contents >> Navigation: Available Functions > Day() |
Syntax
Day( <DateValue> )
Purpose
To determine the Day Of Month for a given date value.
Parameters
<DateValue> may be the name of a date field (such as the .Donation_Date. field), but it may also be any value of Date type -- such as the current date returned by the "Date()" function.
Returns
Day() returns a number in the range of 0..31 as an integer numeric value. If the month is February, leap years are considered. If the date parameter is February 29 and the year is not a leap year, Day() returns zero. If the date parameter is empty (" / / "), Day() returns zero.
Usage
Day() is a date conversion function used to convert a date value to the day of a month. This function is used in combination with CMonth() and Year() to format dates. In addition, it is often used in various date calculations.
Example
The following examples show the Day() function used in several ways:
CALL |
RESULT |
---|---|
Date() |
10/01/2016 |
Day( Date() ) |
1 |
Day( Date() ) + 1 |
2 |
Day( CToD( "" ) ) |
0 |
This example uses Day() in combination with CMonth() and Year() to format a donation date value for the Report Writer:
CMonth( .Donation_Date. ) + Str( Day( .Donation_Date. ) ) + ", " + Str( Year( .Donation_Date. ) )
The result would be similar to:
October 1, 2016