Hello,
I have two date variables VAR_DATE and VAR_TIME
VAR_TIME has time in HH:MM:SS AM/PM format. VAR_TIME = 09:35:40 AM
VAR_DATE has date and time; VAR_DATE = 10/21/2014 12:00:00 PM
How can i change the VAR_DATE to 10/21/2014 09:35:40 AM?
Hello,
I have two date variables VAR_DATE and VAR_TIME
VAR_TIME has time in HH:MM:SS AM/PM format. VAR_TIME = 09:35:40 AM
VAR_DATE has date and time; VAR_DATE = 10/21/2014 12:00:00 PM
How can i change the VAR_DATE to 10/21/2014 09:35:40 AM?
How about using DateValue() on the second and add the result to the first?
By the way, I deleted your duplicate thread. Please don't post the same question twice.
Thanks. Would you be able to give me some sample code please?
Are both variables declared as date type?
Try:
Format(VAR_DATE, "mm/dd/yyyy") & " " & VAR_TIME
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
If both variables are defined as Date you can simply add them together using the + operator.
Yes, except the time component shown is 12:00:00 PM (noon). Result of adding gives a date/time 12 hours off:
10/21/2014 9:35:40 PM
If OP really meant to show midnight time then the addition will work because Access/VBA considers midnight as 0 time.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.