Siebel VB Language Reference > Methods Reference for Siebel VB > Date and Time Methods >

Extract Weekday From Date-Time Value Method


The Extract Weekday From Date-Time Value method returns the day of the week of a date and time value. It returns this value as an integer in the range of 1 through 7, where 1 is Sunday and 7 is Saturday.

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

The return value is an integer variable type. If the return value is null, then this method returns a null variable type. For more information, see Variants.

Format

Weekday(date)

The argument that this method uses is the same as the argument that the Convert String to Date method uses. For more information, see Convert String to Date Method.

Example

The following example determines the day of the week when 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

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.