The DateTime type can hold date
Visual Basic does not support separate types for holding dates only or times only. The Basic syntax DateTime type is similar to Visual Basic's Date type.
You can create DateTime values directly using the date
Note: Date
#8/6/1976 1:20 am# #August 6, 1976# #6 Aug 1976 13:20:19# #6 Aug 1976 1:30:15 pm# #8/6/1976# #10:20 am#
Even though #10:20 am#
looks like it could have the Time type and #8/6/1976#
looks like it could have the Date type, they do not. They both have the DateTime type, as do all date#10:20 am#
as a DateTime value with a null date part. To convert it to the Time type use CTime (#10:20 am#)
.
Instead of using date
CDateTime ("8/6/1976 1:20 am") CDateTime ("10:20 am")
However, there is one key difference between using date
CDateTime ("22 aout 1997") 'Same as #Aug 22, 1997#
Date values can be constructed with CDate and Time values with CTime:
CDate ("Aug 6, 1969") CDate (1969, 8, 6) 'Specify the year, month, day 'Converts the DateTime argument to a Date CDate (#Aug 6, 1969#) CTime ("10:30 am") CTime (10, 30, 0) 'Specify the hour, minute, second CTime (#10:30 am#)
Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com |