On Thu, 2004-05-06 at 21:47 +0800, Tim Finney wrote:
> If I sort these (using 'sort' on my Linux machine), I get:
>
> -0001-01-01
> 0001-01-01
> -0001-12-31
> -0002-01-01
> 0002-01-01
> -0002-02-01
> 0002-02-01
> -0002-02-02
> 0002-02-02
sed 's/\([0-9]\)-/\1/g' | sort -n | sed
's/\(-*\)\(....\)\(..\)\(..\)$/\1\2-\3-\4/' | cat -n
1 -0002-02-02
2 -0002-02-01
3 -0002-01-01
4 -0001-12-31
5 -0001-01-01
6 0001-01-01
7 0002-01-01
8 0002-02-01
9 0002-02-02
I removed all - signs except the optional leading one, then used a
numeric sort, then put the hyphens back, as yuo did for subtraction.
> 00010101 - -00010101 = 00020202
>
> The only thing I can think of is to choose some large negative date
> (4004 BC?), and count everything from there.
For intermediate processing that's probably best, yes.
Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
www.holoweb.net/~liam/picures/oldbooks/ (stock art from old books)
|