Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

WeekdayName Function

Class

Microsoft.VisualBasic.DateAndTime

Syntax

WeekdayName(Weekday, [abbreviate [, FirstDayOfWeekValue]])
Weekday (required; Long)

The ordinal number of the required weekday, from 1 to 7

abbreviate (optional; Boolean)

Specifies whether to return the full day name or an abbreviation

FirstDayOfWeekValue (optional; FirstDayOfWeek constant)

Member of the FirstDayOfWeek enum indicating the first day of the week

Return Value

A String

Description

Returns the name of the day

Rules at a Glance

  • Weekday must be a number between 1 and 7, or the function generates an ArgumentException error.

  • The default value of abbreviate is False.

  • For a list of the members of the FirstDayOfWeek enumeration, see the Weekday Function entry.

  • The default value of FirstDayOfWeekValue is FirstDayOfWeek.Monday.

Programming Tips and Gotchas

  • Since Weekday is an integer, to determine the name of the day of a particular date, combine WeekDayName with a call to the WeekDay function, as the following code fragment shows:

    sDay = WeekDayName(Weekday(dDate, iFirstDay), _
                       bFullName, iFirstDay)

    Note that the value of the FirstDayOfWeek argument must be the same in the calls to both functions for WeekdayName to return an accurate result.

  • Unlike the Weekday function, the WeekdayName function behaves predictably. For example, if you ask for the name of the first day of the week when the week starts on Monday, the function returns Mon or Monday. If you ask for the fifth day of the week for a week that starts on ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata