I’m trying to extract date/times from strings with the following patterns and convert them to date types in Access.
-
“08-Apr-2012 21:26:49”
-
“…Confirmed by SMITH, MD, JOHN (123) on 4/2/2012 11:11:01 AM;”
Can anyone help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add this function to a VBA module:
And then use it like this, for instance in a query:
Make sure you check that hte dates returned are in the proper format and make sense to you.
CDate()interprets the date string in different ways depending on your locale.If you’re not getting the desired result, you will need to modify the code to separate the individual components of the date and rebuild them using
DateSerial()for instance.