Lists: | pgsql-novice |
---|
From: | Lloyd Dieter <ldieter(at)rochester(dot)rr(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | How to get day of week? |
Date: | 2004-12-21 12:28:25 |
Message-ID: | 20041221072825.77715979.ldieter@rochester.rr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
I'm sure I'm missing something obvious, but this is the novice list, so
here goes:
Is there a function to return the day-of-week for a given time/datestamp?
What I'm looking for is something like:
select day(current_timestamp);
That would return the current day of the week (e.g. Monday/Tuesday...)
Thanks,
-Lloyd
From: | Andreas Kretschmer <akretschmer(at)despammed(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: [despammed] How to get day of week? |
Date: | 2004-12-21 12:42:17 |
Message-ID: | 20041221124217.GA26887@Pinguin.wug-glas.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
am 21.12.2004, um 7:28:25 -0500 mailte Lloyd Dieter folgendes:
> I'm sure I'm missing something obvious, but this is the novice list, so
> here goes:
>
> Is there a function to return the day-of-week for a given time/datestamp?
>
> What I'm looking for is something like:
>
> select day(current_timestamp);
>
> That would return the current day of the week (e.g. Monday/Tuesday...)
You search something like this:
select extract(dow from eingang) from a_buch ;
^^^^^^^^^^^^^^^^^^^^^^^^^
Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Tel. NL Heynitz: 035242/47212
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
From: | Lloyd Dieter <ldieter(at)rochester(dot)rr(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: [despammed] How to get day of week? |
Date: | 2004-12-21 13:28:24 |
Message-ID: | 20041221082824.538782a4.ldieter@rochester.rr.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
Thank you, knew it had to be something simple.
-Lloyd
On Tue, 21 Dec 2004 13:42:17 +0100
Andreas Kretschmer <akretschmer(at)despammed(dot)com> wrote thusly:
> am 21.12.2004, um 7:28:25 -0500 mailte Lloyd Dieter folgendes:
> > I'm sure I'm missing something obvious, but this is the novice list,
> > so here goes:
> >
> > Is there a function to return the day-of-week for a given
> > time/datestamp?
> >
> > What I'm looking for is something like:
> >
> > select day(current_timestamp);
> >
> > That would return the current day of the week (e.g. Monday/Tuesday...)
>
> You search something like this:
>
> select extract(dow from eingang) from a_buch ;
> ^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
>
>
> Regards, Andreas
> --
> Andreas Kretschmer (Kontakt: siehe Header)
> Tel. NL Heynitz: 035242/47212
> GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
> === Schollglas Unternehmensgruppe ===
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Andreas Kretschmer <akretschmer(at)despammed(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: [despammed] How to get day of week? |
Date: | 2004-12-21 16:32:08 |
Message-ID: | 20041221163208.GA82969@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
On Tue, Dec 21, 2004 at 01:42:17PM +0100, Andreas Kretschmer wrote:
>
> select extract(dow from eingang) from a_buch ;
See also to_char() in the "Data Type Formatting Functions" section
of the "Functions and Operators" chapter in the documentation.
SELECT to_char(CURRENT_DATE, 'D,Dy,Day');
to_char
-----------------
3,Tue,Tuesday
Note that to_char() and extract() use different numbering for the
day of the week.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From: | Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org> |
---|---|
To: | Lloyd Dieter <ldieter(at)rochester(dot)rr(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: How to get day of week? |
Date: | 2004-12-21 21:55:20 |
Message-ID: | 41C89BC8.3060000@visualdistortion.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-novice |
The function you're looking for is to_char(), and it has tons of options.
http://www.postgresql.org/docs/7.4/static/functions-formatting.html
Jeff
Lloyd Dieter wrote:
>I'm sure I'm missing something obvious, but this is the novice list, so
>here goes:
>
>Is there a function to return the day-of-week for a given time/datestamp?
>
>What I'm looking for is something like:
>
>select day(current_timestamp);
>
>That would return the current day of the week (e.g. Monday/Tuesday...)
>
>Thanks,
>
>-Lloyd
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
>