[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is a time of 00:00 regarded as Null?


Il 30/07/24 16:36, Claus Dietrich ha scritto:
One of my programs failed today. The reason was surprising:

A date consisting of a time component only and generated with an
expression equivalent to this

dStartTime = cDate("00:00")

is regarded as Null. As my program checks the presence of a time
expression with

if dStartTime then ...

it fails, if the time is 00:00, which is supposed to be a valid time.

If this is no bug, how can I check whether a date contains a valid
time-only-component including 00:00 ?

Best regards

Claus



Hi Claus,

here it seems to work correctly, if I write...:
'------------------------
Dim dStartTime As Date

  dStartTime = CDate("00:00")
  If dStartTime = 0 Then Print "START" ' <--- print START
'------------------------

Be careful not to compare it with local dates

Regards
Gianluigi


Follow-Ups:
Re: Why is a time of 00:00 regarded as Null?Gianluigi <gradobag@xxxxxxxxxxx>
References:
Why is a time of 00:00 regarded as Null?Claus Dietrich <claus.dietrich@xxxxxxxxxx>