Re: Sorting on fieldtype Time?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting on fieldtype Time?
Date: 2003-07-09 09:47:32
Message-ID: 20030709114732.A736@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I have a small problem.. I need to sort some rows on a Time field, but
> the time in these rows are recorded on evenings and nights, from 2200 to
> 0600 for instance. The problem is that the time after midnight should
> come after the time before midnight, i.e. 2315, 2345, 0015, 0100 should
> be sorted in this order and not 0015, 0100, 2315,2345.
> Is there a solution to this, other than using Timestamp instead of Time?

You can try subtracting a fixed amount to transfer all times
to before midnight and then sort.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2003-07-09 09:57:31 Re: Sorting on fieldtype Time?
Previous Message Bjorn T Johansen 2003-07-09 09:24:14 Sorting on fieldtype Time?