Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's the diff between Date and DateTime data types?

Status
Not open for further replies.

dpdoug

Programmer
Joined
Nov 27, 2002
Messages
455
Location
US
I am creating some variables that will hold Dates (Ex: 5/10/2004) and Times (Ex: 5:00 PM). Is there any difference as to which data type I should use, or does it really matter?

Code:
Dim DateRequired As Date, TimeRequired as DateTime
 
Dates just hold date values.
DateTime holds a date and a time.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
That's a simple answer. But it makes sense. I had supposed that, but I wasn't really sure.

Lots of times we doubt the obvious because it seems it should be more complicated.
 
By the way, thanks for answering my post, Chip!
 
The other thing that people have problems with (conceptually) with Date and DateTime datatypes is that they expect it to contain a date in a certain format. The important thing to remember is variables of that type only contain date/datetime values. Formatting them is the job of the presentation layer.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top