Re: get date in binary number format

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: "'Alvaro Herrera'" <alvherre(at)atentus(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: get date in binary number format
Date: 2002-09-26 17:13:05
Message-ID: Pine.LNX.4.44.0209261312020.8539-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The function bit is as you say a predefined function in Postgres

It shows as follows

bit bit(bit,integer)

Taking in bit and integer and returning bit

HTH

On Thu, 26 Sep 2002, Johnson, Shaunn wrote:

> Howdy:
>
> I get this when I try the following select:
>
> [snip]
>
> testdb=> select "bit"((date_part('doy', now()))::integer);
> ERROR: Function 'bit(int4)' does not exist
> Unable to identify a function that satisfies the given
> argument types
> You may need to add explicit typecasts
>
> [/snip]
>
> Is there something that I should know about "bit"?
> Is it a pre-defined function (system) or is this
> something I don't have in my version of PostgreSQL?
>
> Thanks all!
>
> -X
>
>
> -----Original Message-----
> From: Alvaro Herrera [mailto:alvherre(at)atentus(dot)com]
> Sent: Thursday, September 26, 2002 11:50 AM
> To: Johnson, Shaunn
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] get date in binary number format
>
>
> 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.
>
>

--
Darren Ferguson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2002-09-26 17:15:21 Re: unlock / drop table
Previous Message Johnson, Shaunn 2002-09-26 17:08:20 Re: get date in binary number format