Re: Selecting date in given format
Posted in 1999
Sorry, if you haven't 7.3 version of dynamic server you
could use just:
select YEAR(date_field)||'-'||MONTH(date_field)||'-'||DAY(date_field)
from table
Of course this is not very good in case you want to get always 2 digits
months and days.
The second way is to set the DBDATE env. variable to
DBDATE=Y4MD-
Of course you can write a stored procedure for conversion (if neither
of the above methods suites your needs)
Best Regards,
Octav
On Wed, Mar 10, 1999 at 02:09:11PM +0000, Honza Pazdziora wrote:
> Hello,
>
> I'm searching for a way to select a date field in some nice format.
> What is the equivalent of Oracle's
>
> select to_char(date_field, 'yyyy-mm-dd') from table
>
> that forces the output string have format 1999-03-10, instead of the
> default 99-03-10. I want to stay in pure SQL for this task.
>
> Any hint would be apprecited,
>
> --
> ------------------------------------------------------------------------
> Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
> make vmlinux.exe -- SGI Visual Workstation Howto
> ------------------------------------------------------------------------
--
Octav Chiriac Phone: (373) 2 21 20 96
NetInfo S.R.L. Fax: (373) 2 21 36 59
Chisinau (373) 2 24 00 83
Moldova, Republic of mailto:com@netinfo-moldova.com