"DateAdd" is driving me crazy

Oseitutuakrasi

New Member
Joined
Jun 7, 2023
Messages
23
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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,221,522
Messages
6,160,308
Members
451,637
Latest member
hvp2262

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