Date not cycling with addition of time

Cummins

Board Regular
Joined
Jul 26, 2011
Messages
58
Trying to figure out issue with adding date and time.
The code is listed below.
I have watched the code while running. The initial date FDateS and FDate(t) value is m/dd/yyyy (9/16/2010) and no time. FDateS has different amounts of time added to it. The issue I have encountered is that once it passes midnight, the date does not change but the time reflects the change to 00:00:00.

Public FDate(1000) As Date
Public FTime(1000) As Date


FDate(t) = CDate(Mid(FindData("sm_Sys_BatchOpenTime"), 1, 10))

For H1 = 1 To n
FDateS = FDate(H1)
For r =1 to 50
FDateS = CDate(FDateS) + CDate(FTime(r)-Ftime(r-1))
Next
Next
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Want to add some clarification...here is the output I am concerned with

9/16/2010 23:00
9/16/2010 23:30
9/16/2010 0:00
9/16/2010 0:30
9/16/2010 1:00
9/16/2010 1:30

It is as if the date is a string instead of a value.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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