"DateAdd" is driving me crazy

Oseitutuakrasi

New Member
Joined
Jun 7, 2023
Messages
38
Office Version
  1. 365
Platform
  1. Windows
I have two textboxes as follows:

TextBox1.value=Time() ' This gives me the correct time (e.g. 11:12:56)
I want to add 90 minutes to the current time and display in the second textbox:

TextBox2.value=DateAdd("n", 90, Time()). 'For reasons I cannot figure out, this gives me 31/12/1899 (followed by the time with the 90 minutes added)

I cannot figure out how to get rid of the "31/12/1899" part. Can anybody help, please?

Thanks Guys!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Not sure why it is doing that, but this should work: Format(DateAdd("n", 90, Time()), "hh:mm:ss")
 
Upvote 0
Solution
Not sure why it is doing that, but this should work: Format(DateAdd("n", 90, Time()), "hh:mm:ss")
Thanks a lot my friend. My formatting was wrong. I copied and pasted your code and ...BINGO!!
Many thanks again.
 
Upvote 0
Not sure why it is doing that, but this should work: Format(DateAdd("n", 90, Time()), "hh:mm:ss")
Hi RoryA, to my surprise, my original code DateAdd("n", 90, Time()) which was giving me problem
is now working together with yours. Just can't figure out why. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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