473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Sorting a list by DateTime stamp -- please help...

Hi,
I have a list object called "myList" with the first item a string and
the second a DateTime. Something like this:

"some text 1", 19/03/2008 12:56:36
"some text 2", 19/03/2008 10:56:36
"some text 3", 19/03/2008 11:56:36
"some text 4", 19/03/2008 13:56:36
I would like to sort "myList" (into a new list) by timestamp such
that the earliest time stamp is a tthe bottom. In this case it would
be:

"some text 2", 19/03/2008 10:56:36

Problem is though I don't know how to do this exactly! Would
appreciate any comments/suggestions/code-samples that you would liek
to share.

Thanking you,
Al.
Mar 19 '08 #1
1 2514

You would be very well served to read:
http://ludwig-stuyck.spaces.live.com/Blog/cns!E36D9BA98FC913B3!398.entry

the article on Generics.

It is in english.

...

Find the Sort section.

...

You can write the comparer "inline" (previous post on this thread) ... or
you can actually code up the the Comparer.

...

<al*****@altavista.comwrote in message
news:1e**********************************@e60g2000 hsh.googlegroups.com...
Hi,
I have a list object called "myList" with the first item a string and
the second a DateTime. Something like this:

"some text 1", 19/03/2008 12:56:36
"some text 2", 19/03/2008 10:56:36
"some text 3", 19/03/2008 11:56:36
"some text 4", 19/03/2008 13:56:36
I would like to sort "myList" (into a new list) by timestamp such
that the earliest time stamp is a tthe bottom. In this case it would
be:

"some text 2", 19/03/2008 10:56:36

Problem is though I don't know how to do this exactly! Would
appreciate any comments/suggestions/code-samples that you would liek
to share.

Thanking you,
Al.

Mar 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Koen | last post by:
Hi! I have a vector containing the following: vector<Base*> theVector; theVector.push_back(new Der1()); theVector.push_back(new Der1()); theVector.push_back(new Der2());...
12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
1
by: Abhijit Bhadra | last post by:
Hi , In C++ , I have some files as per their date of creation . The files are in the form of maple01012005.log maple01142005.log maple01202005.log sample01182005.log
2
by: Samuel | last post by:
Hello, I am trying to convert a local time into UTC ISO8601, then parse it back into local time. I tried the following: ---------------------- #!/usr/bin/python import time import datetime...
0
by: Prasad More | last post by:
I want to open a TIFF file, put a datetime stamp on it and save that file in CompressionCCITT4 format back to the same filename. I have written following code to do this, but getting "Invalid...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
7
by: apotheos | last post by:
I can't seem to get this nailed down and I thought I'd toss it out there as, by gosh, its got to be something simple I'm missing. I have two different database tables of events that use different...
4
by: JB | last post by:
I am trying to get a list of all the active computers running on my domain. I'm writing some remote management style software with WMI, which works fine when i know the computer name, but i just...
4
by: rajtalent | last post by:
hi all, I want to sort the colum when clicks the columnheader using vb.net 2005 .But i receive the following error "Error 1 Overload resolution failed because no accessible 'New' accepts...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.