MS Access remove date but keep time

prwbblue

New Member
Joined
Apr 17, 2019
Messages
2
Hello,

I have a date/time field that either contains the date and time "1/1/1900 5:30:00 PM" or just the time "6:30:00 PM". I would like to remove the date if it's there and only keep the time when I run my query. Can someone help?

Thanks,
Adam
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Welcome to the Board!

You may be able to just use the TIMEVALUE function.

It is important to understand how Access and Excel track date and time. Basically, they store them as numbers, specifically the number of days since 1/0/1900.
So, the days are just integers, and the time is a fraction (the fractional amount of one day). So, you can also get just the time by subtracting the Integer component of the date, i.e.
[MyDate]-Int([MyDate])
and just format the result as time.
 
Upvote 0
Thanks Joe for the quick response! Can you give the full formula example including the format results as time? I'm new at this but I'm learning. :)
Thanks!
 
Upvote 0
Have you tried just adding a calculated field to your query that uses the TIMEVALUE function to see if it returns what you want, i.e.
Code:
CalcField: DateValue([YourDateTimeField])
I am assuming that you know how to create calculated fields in a query. If you do not, just do a Google search on "creating calculated fields in an Access query", and you will finds lots of example, videos, and tutorials.
 
Upvote 0

Forum statistics

Threads
1,223,969
Messages
6,175,680
Members
452,667
Latest member
vanessavalentino83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top