View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default date conversion question

William,

The reason is because Now returns the date and time, so you get something
like 29/02/2004 18:45:32, whereas CDate(lng) returns a pure date, like
29/02/2004. They are not the same, so you get False.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"WIlliam Barnes" wrote in message
...
Why does this code result in a False result?

Public Sub TimeTest()

Dim dte As Date
Dim lng As Long

dte = Now
lng = CLng(dte)

Debug.Print (dte = CDate(lng))

End Sub