Xbasic

DAY Function

Syntax

Day_Of_Month as N = DAY( Date as D )

Day_Of_Month as N = DAY( Date_Time as T )

Arguments

date

A variable containing a date value or a character string containing a legitimate representation of a date value ( ISDATE(Date) = .T.).

Date_Time

A variable containing a date-time value (type T).

Description

DAY() returns an integer corresponding to the day of the month for the Date or Date_Time value.

Example

day(START) -> 9, if START contains 07/09/91
day({1/15/2004}) -> 15

You can create your own custom date formats for reports, forms, mailing labels, and form letters using a combination of the DAY() , CMONTH(), and CYEAR()functions. For example, to display the BIRTHDATE field as "December 18, 1991" in a form letter, define a calculated field using the following expression:

cmonth(BIRTHDATE) + " " + ltrim( str( day(BIRTHDATE) ) )  + ", " + cyear(BIRTHDATE)

In this expression, DAY() returns the day of the month, STR()converts the number to a character field, and LTRIM()strips off leading blanks. You can also use the MDY()function to return formatted date strings.

MDY(BIRTHDATE) -> "May 25, 1968"

See Also