I have several thousand objects with a string property in the format of "yyyy-MM-ddTHH:mm:ssZ". I want to sort these objects by time.
Are there any useful packages or scripts for this?
(Currently I’m just comparing individual numeric values and it seems it’s not very efficient and neat.)
You can use Time::Local to convert your date to timestamp or one of the Date:: modules from cpan. You can have a look at this to see what is available.
Also notice that with the above format sorting the objects lexicographicaly would also do the trick (even if probably somewhat slower than comparing numbers, but initial conversion has it’s cost).
Be careful if you use dates from throughout the world because you may encounter sort problems with timezone and daylight savings. If all datetimes are in the same place that should be OK.