irfantak
asked on
ASP .NET C# Show Only Hourly DateTime values from an Array of 24 hour values.
Someone tried to answer this question yesterday but that solution did not work. I am reposting it. Looks like no one has a solution to my question (even in other forums outside of EExchange). So here we go again. The output of the response.write can be seen in:
http://www.cameradisplay.com/CondorStats/tempdisplaytime.htm
These are 360 different time values, spanning 24 hours, separated from each other by 4 minutes. How can I just show these values in separated by Hourly spans while the intermediate values simply get replaced by blank space (the chart's X-Axis cannot accomodate all 360 values).
DateTime startTime = Convert.ToDateTime(dayArra y[0]);
DateTime endTime = Convert.ToDateTime(dayArra y[dayArray .Length - 2]);
TimeSpan timeSpan = (endTime - startTime);
//Response.Write(startTime .ToString( ) + " " + endTime.ToString() + " " + timeSpan.ToString());
for (int i = 0; i < dayArray.Length - 2; i++)//loop to one less because of extra comma/space at end
{
DateTime currentTime = Convert.ToDateTime(dayArra y[i]);
Response.Write(currentTime .ToString( ) + "<br>");
}
http://www.cameradisplay.com/CondorStats/tempdisplaytime.htm
These are 360 different time values, spanning 24 hours, separated from each other by 4 minutes. How can I just show these values in separated by Hourly spans while the intermediate values simply get replaced by blank space (the chart's X-Axis cannot accomodate all 360 values).
DateTime startTime = Convert.ToDateTime(dayArra
DateTime endTime = Convert.ToDateTime(dayArra
TimeSpan timeSpan = (endTime - startTime);
//Response.Write(startTime
for (int i = 0; i < dayArray.Length - 2; i++)//loop to one less because of extra comma/space at end
{
DateTime currentTime = Convert.ToDateTime(dayArra
Response.Write(currentTime
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey, your solution was so simple but I have made good progress. Will be back! Thanks!
ASKER
Yes, it works. Thanks! Now I have to figure out data for 'Weekly' and 'Monthly' charts...But that is for another time.
If the concept is the same, but the constant is different your life will be easy!
ASKER
Here is what I am trying to do: Replicate the following chart and the code above builds the X-Axis of the chart: http://central.condor.clemson.edu/public/condor-stats/Hour.html
Basically, there are 360 data values which cannot fit on X-axis and so I only need to show values which are 1+ hours apart on X-axis.
But the X-axis does need to have some filler/empty data so that the x-axis can build (corresponding to y-axis values) except that the display data on x-axis will be a few date/time values.
Makes sense?
Thanks.