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
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

clares

Well-known Member
Joined
Mar 14, 2002
Messages
557
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
 

Seti

Well-known Member
Joined
May 19, 2002
Messages
2,916
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.
 

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
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
 

clares

Well-known Member
Joined
Mar 14, 2002
Messages
557
OK guys. Thanks.

Time() returns the system time which will do

Kindest Regards

Peter
 

Watch MrExcel Video

Forum statistics

Threads
1,122,694
Messages
5,597,571
Members
414,156
Latest member
WDMix

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
Top