Entering date and time seperately

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

I'm writing a calendar application. The users want to be able to enter dates
and times in separate controls. How do I do this? I understand a datetime
column contains both. Can a datetime column contain just a time with no date?
And can a datetime column contain just a date with no time?
 
The Date data type in VBA is an eight byte floating point number where the
integer portion represents the date as the number of days relative to 30
Dec, 1899, and the decimal portion represents the time as a fraction of a
day. Yes, it's possible to store just a time in there, but recognize that as
far as Access is concerned, you've entered a time on 30 Dec, 1899.

Just because your users want to enter dates and times as separate values
doesn't mean you have to store them that way! If you've got a date value and
a time value, you can simply add them together to result in a timestamp. If
you've got a timestamp and you want only the date portion, you can use the
DateValue function. If you've got a timestamp and you want only the time
portion, you can use the TimeValue function.
 
Back
Top