> Not quite...TO_CHAR() takes a date and a format string as args and then returns
> a char-type of that date formatted according to the given format string.
> create table foo (bday date);
> insert into foo values (TO_DATE('12-FEB-1969','DD-MON-YYYY'));
> select TO_CHAR(bday, '"Birthday is" fmMonth ddth, Year') as Birthday from foo;
>
> BIRTHDAY
> ------------------------------------------------------------------------------
> Birthday is February 12th, Nineteen Sixty-Nine
May be possible for v6.2. Lousy function names, though, wrt other
Postgres name conventions... So, TO_DATE() and TO_CHAR() are symmetric,
so that you can do the following (?):
select TO_CHAR(
TO_DATE('12-FEB-1969','"Birthday is" fmMonth ddth, Year'),
'"Birthday is" fmMonth ddth, Year');
> Not that I want postgres to be exactly like Oracle, but their date handling
> is one of their strong points, IMHO.
Boy, add some features and people get _so_ demanding :)
The first step was adding date/time types which are robust and general
enough to build on (datetime and timespan are, I believe). The next step
is to add functionality, so keep those suggestions coming.
> Coming from a math theory background, why are people so intent on separating
> date and time? They're both _time_ really... :) One datatype that contains
> both is the only "perfect" date or time type. (See what happens when I have
> too much coffee in the morning? :)
*slurp* Yeah, me too. I don't use date or time separately myself, and
don't see why others do. I suspect that historically date and time were
implemented before software was in anything other than a local
environment. Now with global networking and distributed computing, the
premise might be a bit dated, so to speak.
- Tom
------------------------------