Click here to Skip to main content
15,938,682 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a list of datetime collection and i wanted to find the index of all the similar datetime in collection and if i find similar values i want to add some extra time to make it different like 1-2-3 minutes but dont just want to plus a number because if i plus a constant it will be same again :)
Any ideas guys i am on .net 3.5

What I have tried:

Trying something common not worth mentioning
Posted
Updated 20-Apr-16 12:19pm
Comments
CHill60 20-Apr-16 17:21pm    
What you have tried *is* worth mentioning - if only to give us a clue what the problem is. Define "similar value" or describe what you are actually trying to achieve by doing this

1 solution

Thanks Guys: done short and simple
dtGLOScheduleDateTime is a collection of date and time

C#
private void AddOffset_DateTime()
       {
           int i, j;
           for (i = 0; i < dtGLOScheduleDateTime.Count; i++)
           {
             for(j=i+1;j < dtGLOScheduleDateTime.Count;j++)
             {
                 if (dtGLOScheduleDateTime[i] == dtGLOScheduleDateTime[j])
                 {
                     dtGLOScheduleDateTime[j] = dtGLOScheduleDateTime[j].AddMinutes(1*j);
                 }
             }
           }
 
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