Re: get date in binary number format

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: get date in binary number format
Date: 2002-09-26 15:49:41
Message-ID: Pine.LNX.4.44.0209261145360.9690-100000@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Johnson, Shaunn dijo:

> Howdy:
>
> Silly question time -
>
> Is there a way to get the date and change
> it into a binary number?

Well, you can get the day of the year in binary:

testing=> select "bit"((date_part('doy', now()))::integer);
bit
----------------------------------
00000000000000000000000100001101
(1 row)

> The algorithm to select backup number would be the
> smallest non-zero place in binary representation of
> the backup number (tape).

Recursive definition? Sorry, I don't understand the algorithm.

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Ni aun el genio muy grande llegaria muy lejos
si tuviera que sacarlo todo de su propio interior" (Goethe)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mourad_dhambri 2002-09-26 15:52:34 dblink
Previous Message Greg Copeland 2002-09-26 15:41:37 Re: [HACKERS] Performance while loading data and indexing