DateDiff Compilation Error
Getting compiation error,-don't know why. Thanks. - Steve
Compiler Error Message: BC30451: Name 'DateDiff' is not declared.
Source Error:
Line 90: birthdate = "6/3/1944"
Line 91: curDate = DateTime.Now
Line 92: age = DateDiff(DateInterval.Year, curDate, birthdate)
Line 93: Return age.ToString
Line 94: End Function
Imports System
Imports System.Web.UI
Imports System.DateTime
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.OLEDB
Public Class listingdetails
Inherits System.Web.UI.Page
'--------
Deleted irrelevant code
'-------
Function DisplayAge(ByVal birthday As Object, ByVal birthmonth As Object, ByVal birthyear As Object) As String
'----- see page 342 ASP.NET Data Web Controls
Dim bday As String
Dim bmonth As String
Dim byear As String
Dim birthdate As Date
Dim curDate As Date
Dim age As Long
bday = birthday.ToString
bmonth = birthmonth.ToString
byear = birthyear.ToString
birthdate = CDate(bmonth & "/" & bday & "/" & byear)
birthdate = "6/3/1944"
curDate = DateTime.Now
age = DateDiff(DateInterval.Year, curDate, birthdate)
Return age.ToString
End Function
|