Re: Can I store Date and Time in long integer?
- From: "Jim Mack" <jmack@xxxxxxxxxxxxxxx>
- Date: Fri, 1 Sep 2006 13:48:00 -0400
Ralph wrote:
The date values in VB and the two in MS SQL are based on three
different epochs/counts and are not equivalent.
A VB is a decimal:
The integer portion represents the number of whole days since the
epoch. The decimal portion represents the fraction of a day since
midnight of the epoch
It starts from Midnight December 30, 1899.
Negatives can be used for earlier dates, but not all tools will be
able to decypher what you are talking about. <g>
Frankly, I am at a lost of why you would want to store datetime as a
long when you can just as easily store and pass around a decimal?
And the fact that VB / OLE dates are stored in the same form as a double is overkill. If you _really_ need to store a conventional VB date/time in 4 bytes, just use a Single (Dat! = CSng(Now)). As long as you're talking about relatively recent dates, you can get the exact date, and minor (if any) loss of precision for the time.
--
Jim Mack
MicroDexterity Inc
www.microdexterity.com
.
- References:
- Can I store Date and Time in long integer?
- From: Thomas Malia
- Re: Can I store Date and Time in long integer?
- From: Ralph
- Can I store Date and Time in long integer?
- Prev by Date: Re: Open File
- Next by Date: Re: Open File
- Previous by thread: Re: Can I store Date and Time in long integer?
- Next by thread: Re: Can I store Date and Time in long integer?
- Index(es):