Re: Date Variable




So if datDate = 0 VB will interpret it to be 12/30/1899? And I assume
assigning 0 to datDate is the only way to initialize it?

Also in my old DB I have a field Date_Paid defined as Date. What I would do
would test the value of the field if Date_Paid = "" It would mean the
record (transaction) is open. How do I test for such a condition now? I'm
using MySql.

Also I have a series of programs that does all kinds of updates. In order to
assure that procees was completed properly I have this safeguard: Before
that program is started I assign datProcess (Date Filed...MySql) to equal
Todays date datProcess = Today when I complete the job I null out (or used
to) the date. How do I do it now? (If I assign 0 then the field has a
value!)

Thank You

"Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
wrote in message news:pJidnXfUjata2aTeRVn-3w@xxxxxxxxxxxxxx
> > > I'm not sure exactly what you are asking here. Why do you
> think it
> > > would be any different than assigning a value to a date at any
> > > other time within your program? Perhaps if you explained what
> you
> > > are after in a little more detail, we might be able to give
> you a
> > > better answer.
> > >
> > I'm sorry how do initialize a date variable to have no value?
>
> You can't; there is no such thing as a Date without a value. A
> Date variable is initialized by VB as the "zero-date" which is
> December 30, 1899. Dates are stored as (but they are not actually)
> Double values, so the zero-date actually has a value of 0; but,
> since it is of type Date, the system will interpret that as
> December 30, 1899. Just so you know, the integer part of the
> Double used to hold date values stores the number of days passed
> from date-zero (positive is after date-zero, negative is before
> date-zero) and the fraction part of the Double stores the time
> part of the date (number of hours past midnight divided by the 24
> hours in a day).
>
> Rick
>
>


.



Relevant Pages

  • Re: Date Variable
    ... > I'm sorry how do initialize a date variable to have no value? ... Double values, so the zero-date actually has a value of 0; ... Double used to hold date values stores the number of days passed ... from date-zero (positive is after date-zero, ...
    (comp.lang.basic.visual.misc)
  • Re: Initializing static readonly methods
    ... public class TestClass ... //So assigning a value to readonly is perfectly fine. ... //readonly values are has to be initialized in constructor. ... There is no other place to initialize them. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [ath5k-devel] [PATCH 1/1] ath5k: fix hw rate index condition
    ... this by checking earlier for the error or simply assigning it an actual ... I guess an alternative is to initialize to 0, ... rather than warn and not use a valid rate at all. ... Mind you I haven't checked this code in while. ...
    (Linux-Kernel)
  • Re: Beginners question: assigning same value to many variables
    ... Subject: Beginner's question: assigning same value to ... I presume you want each variable initialized to a _different_ empty ... string. ... it's not too hard to initialize a group of instance variables to ...
    (comp.lang.ruby)
  • Re: [ath5k-devel] [PATCH 1/1] ath5k: fix hw rate index condition
    ... this by checking earlier for the error or simply assigning it an actual ... I guess an alternative is to initialize to 0, ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)