Access Query Replace String

kashif.special2005

Active Member
Joined
Oct 26, 2009
Messages
443
Hi,

I am new Access I have a date column, and the data in this column is with date and hour and I want to completely remove hour part from that data.

like below is the one in the date column, and I want to remove hour part.

08.07.2017 02:00:00

after removing the hour part the data will be like below.

08.07.2017

Please help me to achieve this task.

Thanks
Kashif
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Rich (BB code):
Rich (BB code):
dim s as string 
dim s2 as string 

s = "08.07.2017 02:00:00"

s2 = left( s, 10 )  

debug.print s2




 
Upvote 0
If the field is in DATE format and not string, then in an update query you can apply the INT function which will return only the integer portion of the Date. Dates in Access are stored as numbers beginning with Jan 1, 1900. The time in a field is the decimal portion of that number while the date is the integer portion.
 
Upvote 0
If this is a table, why not just format the field to short date? No code or functions needed.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,241
Members
449,075
Latest member
staticfluids

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