Re: What day is it - when it isn't NOW()?

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: tomg(at)sqlclinic(dot)net
Cc: Postgres SQL List <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: What day is it - when it isn't NOW()?
Date: 2003-08-01 18:28:11
Message-ID: 1059762491.41648.8.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

'2003-08-04' is ambiguous. It could be a text string, a date, something
else. So cast it.

SELECT to_char('2003-08-04'::date, 'Day');

> SELECT to_char(now(), 'Day'); returns Friday as I'd hoped.
> But how do I return the day of the week for a specific date other
> than now()? I'm looking for something along the lines of:
> SELECT to_char('2003-08-04', 'Day') without much success.
>
> Can anyone point me to the right function/combination of functions
> to achieve this?
>
> Thanks!
>
> -----------------------------------------------------------------------
> Thomas Good e-mail: tomg(at)sqlclinic(dot)net
> Programmer/Analyst phone: (+1) 718.818.5528
> Residential Services fax: (+1) 718.818.5056
> Behavioral Health Services, SVCMC-NY mobile: (+1) 917.282.7359
>
> // Welches ist das groessere Verbrechen?
> // Massenvernichtungswaffen besitzen oder sie erfinden?
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-08-01 18:28:25 Re: What day is it - when it isn't NOW()?
Previous Message tomg 2003-08-01 18:27:05 What day is it - when it isn't NOW()?