Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello all, In a project I'm working currently, I have to plot a graph against time.
The time is in the format : hh:mm:ss like 21:00:05, 21:03:09, 21:15:06, 21:15:55, 22:15:06, 22:15:55

Now my manager wants me to start the time at a whole number, that is make the initial time to start at 21:00:00 , and increment it in such a way that the next number is a whole number 21:05:00.

ex: 21:00:00, 21:15:00, 21:30:00, 21:45:00, 22:00:00

Also not always the time will start at 21:03:05. What ever time it starts, I must make that in an order.

Need help please..


I have included C++ in tags, because I can change these values pro grammatically before displaying in excel. I'm not sure weather to use the number representation of time to calculate or the general or the time itself...
Posted
Updated 28-Jun-12 22:34pm
v5

You can use various formulae to extract just the hours or minutes from the time and use that as the starting point for your sequence. You did not make it clear how much of this you are implementing by C++ program and how much will be done directly in the spreadsheet.
 
Share this answer
 
Comments
Sumal.V 29-Jun-12 6:01am    
I display the time from my C++ programming into an excel sheet. Now I work with this to produce the excel graph. I do not get much response if its excel. should I take off the c++ tag ?
Richard MacCutchan 29-Jun-12 6:06am    
Creating graphs in Excel is more or less automatic; I'm not sure what help you are asking for, but it does not sound like it's C++.

Sumal.V 29-Jun-12 6:14am    
But v can always format the axis. An that is what I'm trying to do..formatting the x-axis containing the time...
Richard MacCutchan 29-Jun-12 6:17am    
Sorry that is still not clear. As I said this is mostly automatic in Excel, you just create a set of values and the chart wizard puts them in the right place. Try a Google search for "excel chart" and see if you can get some samples that will help.
In the chart under Axis option, change the time format to general.

1)Make minimum value equal to 0.041666667 (Actual representation of the time hour:01)If the time starts at some other time say 3 or 5 'o clock, then multiply this 3 or 5 with the minimum value to get the starting value.

2)Make major value to be 0.03472222 , this is the 5 minutes interval.
(1 sec = 0.006944444)

this gives the series with defined interval.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900