Siebel VB Language Reference > VB Language Reference >

DateSerial Function

This standard VB function returns a date value for the year, month, and day specified.


DateSerial(year, month, day)



An integer representing a year between 100 and 2099 or a numeric expression


An integer representing a month between 1 and 12 or a numeric expression


An integer representing a day between 1 and 31 or a numeric expression


A variant of vartype 7 (date) that represents a date from January 1, 100, through December 31, 9999, where January 1, 1900, is 2.


A numeric expression can be used for any of the arguments to specify a relative date: a number of days, months, or years before or after a certain date.


This example finds the day of the week for November 7 in the year 2009.

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

See Also

DateValue Function
Day Function
Format Function
Month Function
Now Function
TimeSerial Function
TimeValue Function
WebApplet_InvokeMethod Event
Year Function

Siebel VB Language Reference