The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > UNIX and Linux Applications
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-22-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
All you care about is the mm part.

Programatically I would transform the date column in the array, to a 'season value' before doing any sorting.

Create a vector (assuming zero based) S with 12 elements s[0..2] == 0 (Spring),
s[3..5] == 1 (Summer) and so on.

For each row in your array, get the mm substring from the date. Convert the mm to an integer say i, replace the date value in the column with s[i]. Use a length(column) to see if the year 2000 problem exists.

If you sort numerically on the transformed date column, you get seasonal order. You can also preserve the date by adding another column to the array, transforming into it, then sorting.