GBIC: Date and Time
The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.
'VB supports a Date data type
Dim D1 As Date , D2 As Date
NumberDays = D2 - D1 'subtracting dates gives days (Single data type)
'Functions
iResults = Second(DateVar) 'returns 1-59
iResults = Minute(DateVar) 'returns 1-59
iResults = Hour(DateVar) 'returns 1-23
iResults = Day(DateVar) 'returns 1-31
iResults = Month(DateVar) 'returns 1-12
iResults = Weekday(DateVar) 'returns 1-7
iResults = Year(DateVar) 'returns 4 digit year
'Set time/date
Time = TimeString
Date = DateString
'Get time/date
DateVar = Date
TimeVar = Time
'Time Operations
DateAdd
DateDiff
DatePart
'Time Functions
DateSerial
DateValue
TimeSerial
TimeValue
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.