Solved Update a Date/Time Field - Date is already a field but I need to add time as 12:00:00 PM (1 Viewer)

rosef

New member
Local time
Today, 14:36
Joined
Jan 18, 2021
Messages
9
I have a Date/Time field (1 Eye Exam Date) in an Access table but I need to update at Start time field with 1 Eye Exam Date plus 12:00:00 PM. I have tried updating the Start Time with 1 Eye Exam Date+" "+ 12:00:00 PM but I received a validation error. I have tried creating a time field with 12:00:00 PM in and adding the field together in an update query but that didn't work either, received a validation error. I am sure this have to do with the field type and I have the wrong format. I am not a developer. Any help would be greatly appreciated.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:36
Joined
May 21, 2018
Messages
8,525
int([yourDateField) + .5
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:36
Joined
May 21, 2018
Messages
8,525
The reason is all date fields have a time component. It just may not be formatted to show it. Dates are stored as number with an integer and decimal portion. The integer portion is the days since a base date (1/1/1899) and the decimal portion is the fraction of a day which is the time.
0 is 12AM
.25 is 6 am
.5 is 12pm
.75 is 6 pm
and now is
?now & cdbl(now)
1/18/2021 8:03:18 PM 44214.835625
44214 days since 1/1/1899 and .835625 of a full day is 8:03:18 PM
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 22:36
Joined
Jul 9, 2003
Messages
16,271
I blogged/YouTubed about adding time to a date on my website here:-


Might be of interest
 

rosef

New member
Local time
Today, 14:36
Joined
Jan 18, 2021
Messages
9
The reason is all date fields have a time component. It just may not be formatted to show it. Dates are stored as number with an integer and decimal portion. The integer portion is the days since a base date (1/1/1899) and the decimal portion is the fraction of a day which is the time.
0 is 12AM
.25 is 6 am
.5 is 12pm
.75 is 6 pm
and now is
?now & cdbl(now)
1/18/2021 8:03:18 PM 44214.835625
44214 days since 1/1/1899 and .835625 of a full day is 8:03:18 PM

int([yourDateField) + .5
Thanks so much. This is just what I needed.
 
Last edited:

Users who are viewing this thread

Top Bottom