Adding days to a date

CesarAustin

Board Regular
Joined
Aug 21, 2004
Messages
147
Hi... hope someone can help me... what i'm trying to do is add "Days" to a date... example: if i have 1/1/2021... i want to add 1096 days (which is 3 years) to that date... so the new date would be 1/1/2024... i totally suck at SQL.. so i was hoping there was something i can add to the "Update to:" hope someone can help
access.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
well.. I feel dumb.... I checked and my "EOLDate" column was formatted as "ShortText"... I changed it to "Date/Time" and that worked... but if someone has a better way to do the same thing... that would be great
 
Upvote 0
Not necessarily better for this case but you could look into DateAdd function for next time. You didn't say there was a "Data type mismatch error" so the quotes around 1096 were a dead give away. If you don't provide them in criteria for text fields, Access will add them.
 
Upvote 0
Well it looks like you found the chief cause of the problem but to your second issue of whether there's a better way, the answer is 'yes'.

I'd use DateDiff() in this case as that will let you specify an interval of years instead of trying to 'fake it' with (365×3) - which cannot accommodate leapyears.

 
Upvote 0
Good grief. I need to pay better attention to what I'm saying and what I'm thinking...

DateDiff() tells you how many units of the specified interval are between two dates. When you want to add or subtract an interval to a date, use DateAdd()...

 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
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