DayName

Description

Determines the day of the week in a date value and returns the weekday’s name.

Syntax

DayName ( date )

Argument

Description

date

A date value for which you want the name of the day

Returns

String. Returns a string whose value is the weekday (Sunday, Monday, and so on) of date. If date is null, DayName returns null.

Usage

DayName returns a name in the language of the runtime files available on the machine where the application is run. If you have installed localized runtime files in the development environment or on a user’s machine, then on that machine the name returned by DayName is in the language of the localized files.

For information about localized runtime files, which are available in French, German, Italian, Spanish, Dutch, Danish, Norwegian, and Swedish, see Application Techniques.

Examples

Example 1

These statements evaluate the date literal 2003-07-04 and set day_name to Sunday:

string day_name

day_name = DayName(2003-07-04)

Example 2

These statements check to be sure the date in sle_date is valid, and if so set day_name to the day in sle_date:

string day_name


IF IsDate(sle_date.Text) THEN

    day_name = DayName(Date(sle_date.Text))

ELSE

    MessageBox("Error", &

    "This date is invalid: " &

    + sle_date.Text)

END IF

See also