Avatar of Sivasan
Flag for United States of America asked on

Add time to a date field in Ms access

Hi there,
I have an event in access form where I have a datetime field where I take the date part of the field and I need to add a hard coded time of 8:30 am. Please let me know the correct format/Syntex for this.

Dim uptime as date

uptime = Format (entertime,"mm/dd/yyyy")       + 08:30  (when I try adding 8:30 doesn't work

so if entertime is 5/27/2012 10:00 am  
I want uptime to be 5/27/2012  8:30 am  so basically take the date value from entertime and add 8:30 am to it and assign it to uptime.

Microsoft Access

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dale Fye

NewTime = DateValue(upTime) +timeserial(8,30,0)

uptime = datepart(entertime)   +  #08:30:00#

However it's not clear where entertime is coming from and the syntax may need adjusting depending on the source.

Worked.That was quick, thanks a billion...
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Dale Fye


I think you picked the wrong answer.  using the format() function will not change the value of a variable.  You will either need to use syntax similar to what I provided, or Peter provided to get rid of the 10:00 AM and replace it with 8:30

lol, I think he wants to add time to the format, not add time to the date, not clear.
Dale Fye

Actually, I thought it was pretty clear:

"so if entertime is 5/27/2012 10:00 am  
I want uptime to be 5/27/2012  8:30 am  so basically take the date value from entertime and add 8:30 am to it and assign it to uptime."

uptime = DateValue(entertime) + timeserial(8,30,0)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Hi Fyed,

I just did
uptime = Format (entertime,"mm/dd/yyyy 08:30:00")  and it worked, I just saw the other two anwer right now, so I'm not sure.
Dale Fye

interesting, but that will give you a string as your result, not a date/time value.

If that works for you, I'm ok with it.  Just wanted you to understand that using the format function returns a string, not a date/time value.


Hi Dale,
Thank you for your valuable comments, I will check on that.Sorry I missed seeing the post you two posted before I accepted the solution. I really really appreciate the time you all have taken to posted a solution.
Thank you very very very much!
Your help has saved me hundreds of hours of internet surfing.