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!

Difference between all the date and time types

Status
Not open for further replies.

steve1rm

Programmer
Joined
Aug 26, 2006
Messages
255
Location
GB
Hello,

Sometimes I really confused with all these different ways you can express dates and times.

There are Date, DateTime, and DateAndTime, I am sure there are others.

I am never sure which one i should use for what situation.

Can anyone help clear this up for me.

Many thanks in advance,

Steve
 
DateAndTime is not a data type - that is, you cannot do something like this:

Dim d As DateAndTime

DateAndTime is a module that contains all of the date and time functions used to manipulate dates and times, such as DateAdd, DateDiff, etc.


As fro Date and DateTime, here's what MSDN has to say:

MSDN said:
Date variables are stored as IEEE 64-bit (8-byte) integers that represent dates ranging from January 1 of the year 1 through December 31 of the year 9999, and times from 0:00:00 (midnight) through 11:59:59 PM.

Date values must be enclosed within number signs (#) and be in the format M/d/yyyy, for example #5/31/1993#. If you convert a Date value to the String type, the date is rendered according to the short date format recognized by your computer, and the time is rendered according to the time format (either 12-hour or 24-hour) in effect on your computer.

The equivalent .NET data type is System.DateTime.

So basically, the Date and DateTime type are the same.

That's really about it for the Date data types. There are several date and time functions, but as for types Date and DateTime are it.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top