Sorts datetime series.
DTSORT(date, time, order)
date |
- |
A series of Julian integer dates. |
||||||
time |
- |
A series of time of day values. |
||||||
order |
- |
Optional. An integer or string, the sort direction.
|
DTSORT(datetime, order)
datetime |
- |
An array, the date and time values in adjacent columns. |
||||||
order |
- |
Optional. An integer or string, the sort direction.
|
A series of sorted datetime values.
W1: {datetime(2030,5,10,9,15,0), datetime(2030,5,10,14,30,0), datetime(2030,5,10,7,45,0), datetime(2029,12,25,12,0,0)}
W2: dtsort(w1)
W1 contains the datetime values:
5/10/2030 9:15:00
5/10/2030 14:30:00
5/10/2030 7:45:00
12/25/2029 12:00:00
W2 sorts the datetimes in ascending order.
12/25/2029 12:00:00
5/10/2030 7:45:00
5/10/2030 9:15:00
5/10/2030 14:30:00
W3: {datetime(2030,5,10,9,15,0), datetime(2030,5,10,14,30,0), datetime(2030,5,10,7,45,0), datetime(2029,12,25,12,0,0)}
W4: dtsort(w3, 0)
Same as above, except the datetimes are sorted in descending order.
W4 contains the datetimes:
5/10/2030 14:30:00
5/10/2030 9:15:00
5/10/2030 7:45:00
12/25/2029 12:00:00
W1: gnorm(1000, 10000)
W2: getdt(w1)
W3: rowperm(w2)
W4: dtsort(w3)
W5: {isequal(w2, w4)}
W1 contains 1000 random samples with a DELTAX of 10000 seconds.
W2 obtains the wall clock date and time of each sample.
W3 shuffles the date and time rows.
W4 sorts the shuffled date and time rows in ascending order.
W5 is 1, indicating the sorted date and time values equal the original date and time values.
DTSORT sorts a series of datetimes in ascending or descending order.
Note, unlike SORT, the default order for DTSORT is 1 or "ascend".