Separating Date/Time Field

A

admindandr

How do I separate a Date/Time Field in a query, such that
I have two separate field(s) one Date and one Time?
 
J

John Spencer (MVP)

Use the DateValue and TimeValue functions
SELECT DateValue(SomeField) as TheDate,
TimeValue(SomeField) as TheTime
FROM ...

or
CDate(CLng(SomeField)) as TheDate,
CDate(SomeField-CLng(SomeField)) as TheTime

OR ...
 
D

Dave

If your table has the format '16/10/2003 16:34:07' your
query can use

Left(Str([fieldname]),10) for the date and

Right(Str([fieldname]),8) for the time
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top