Time Value

clares

Well-known Member
Joined
Mar 14, 2002
Messages
557
Hi All

Wondering if anyone can help me. I have a function in my workbook returning the current time. I am using =Now() and formatted the cell B9 to Time. The contents of the cell is 14:37:40. This is fine.

I am trying to use VBA to store this value and add 2 hours to it so that the new time can be stored in a variable, and used in an email. But the value that I am receiving is 38013.6093769676! this is before I add 2 hours to it.

Is there a way or what do I have to do to add 2 hours to the current time. There is no reason why this should be collected from the workbook. I am happy for VBA to add two hours to current time!
Kindest Regards

Peter
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Thanks for that. Thats great. But I need also to start with the correct time. 38013.6093769676 doesn't represent 14:37:40? any ideas or what function can I use to capture correct time value.

Kindest Regards

Peter
 
Upvote 0
The portion to the left of the decimal point is the date and to the right is the time. So 38013 is 1/27/04 (measured in elapsed days since 1/1/1900 or 1904 or sometime around there.

The .6093769676 is the portion of the day that has elapsed, 60% or so which is 2:37 PM or 14:37.
 
Upvote 0
clares said:
Thanks for that. Thats great. But I need also to start with the correct time. 38013.6093769676 doesn't represent 14:37:40? any ideas or what function can I use to capture correct time value.

Kindest Regards

Peter
hi!
i think that is the representation of january 27, 2004 2.37 pm


edit:
format the cell containing that value to mmmm dd, yyyy hh:mm:ss
 
Upvote 0
OK guys. Thanks.

Time() returns the system time which will do

Kindest Regards

Peter
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,293
Members
448,564
Latest member
ED38

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