How to check if date variable contains time

Guys, how do I check if a date variable contains the time as well? Well
I could convert it to a double and check if it's an integer but I was hoping to know if there is a more official / sophistical method of doing this. Thanks guys!! = ))
developingprogrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BitsqueezerCommented:
Hi,

you can use whatever you want. Converting to a double and check if it is integer is one method. Another is to test if TimeValue of your date/time field = 0, that's the same, only a little bit shorter and faster.

Cheers,

Christian
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gustav BrockCIOCommented:
It's quite simple.

Quick and dirty:

If Int(datDate) = datDate Then
   ' No time.
End If

or the more polished way:

If DateDiff("s", TimeValue(datDate), #00:00#) = 0 Then
  ' No time.
End If

/gustav
0
developingprogrammerAuthor Commented:
Whao I didn't know TimeValue existed!! Haha, I guess programming language is very much like English language. Either read more to increase vocab or read the dictionary to increase vocab. I read the dictionary for 2 years with all the phonetics even of the most basic words haha - looks like I need to do the same for programming!! Thanks guys!!! = ))
0
BitsqueezerCommented:
Hi,

forget it, you'll not learn any existing property or method of VBA and also the Access (or other Office) object model. I use Access since 2.0 and I also always learn some new things nowadays. I've read a very old journal about VBA these days and found a little function like "TypeName" which returns the text "String" if you try that on a variable of this type. Never needed that, but a few days ago I made a little demo database to show the type name using VarType and a Select Case statement - there I were be able to use that instead - so it's not needed to learn that all, only before you do things where you think "is there maybe anything out of the box?" simply start a Google and type in what you want to do and in 95% you will find an internal method or a method someone else had already made.

As I said earlier: You don't need to know anything, you only need to know where to find an answer.

Cheers,

Christian
0
developingprogrammerAuthor Commented:
got it, thanks Christian!! = ))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.