Siebel VB Language Reference > VB Language Reference >

Weekday Function


This standard VB function returns the day of the week for a specified date-time value.

Syntax

Weekday(date)

Argument
Description

date

An expression containing a date/time value

Returns

An integer between 1 and 7, inclusive, representing a day of the week, where 1 = Sunday and 7 = Saturday.

Usage

Weekday accepts any expression, including strings, and attempts to convert the input value to a date value.

The return value is a variant of vartype 2 (integer). If the value of date is NULL, a variant of vartype 1 (Null) is returned.

Example

This example finds the day of the week on which November 7 occurs in the year 2009.

Sub Button_Click
   Dim checkdate
   Dim daynumber
   Dim msgtext
   Dim checkday as Variant
   Const checkyear = 2009
   Const checkmonth = 11
   Let checkday = 7
   checkdate = DateSerial(checkyear,checkmonth,checkday)
   daynumber = Weekday(checkdate)
   msgtext = "November 7, 2009 falls on a " & _
   Format(daynumber, "dddd")
End Sub

Related Topics

Date Function
Date Statement
Day Function
Hour Function
Minute Function
Month Function
Now Function
Second Function
Year Function

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.