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

Extract Month From Date-Time Value Method


The Extract Month From Date-Time Value method returns the month component of a date and time value. The return value is an integer variable type in the range of 1 through 12. If the return value is null, then this method returns a null variable type. For more information, see Variants.

Format

Month(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.

If the value in the date argument does not evaluate to a date and time or to a time value, then this method returns 0 (zero). For example:

  • The value 11/20 or the value 11-20-2001 returns a valid results.
  • The value 1120 returns a 0.
Example

The following example finds the month in the range of 1 through 12 and the day in the range of 1 through 31 for this Thursday:

Sub Button_Click
      Dim x As Integer, Today As Variant
      Dim msgtext
      Today = DateValue(Now)
      Let x = 0
      Do While Weekday(Today + x) <> 5
         x = x + 1
      Loop
      msgtext = "This Thursday is: " & Month(Today + x) &"/" _
            & Day(Today + x)
End Sub

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