pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feeddate_part - multiple values in format?
3+ messages / 2 participants
[nested] [flat]
* date_part - multiple values in format?
@ 2000-03-02 15:10 Emils Klotins <emils@mail.usis.bkc.lv>
2000-03-02 15:46 ` Re: [SQL] date_part - multiple values in format? Tom Lane <tgl@sss.pgh.pa.us>
2000-03-03 08:51 ` Re: [SQL] date_part - multiple values in format? Emils Klotins <emils@mail.usis.bkc.lv>
0 siblings, 2 replies; 3+ messages in thread
From: Emils Klotins @ 2000-03-02 15:10 UTC (permalink / raw)
To: pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Is there a way to format date according to a template or
anything like that?
Looked at the docs, didn't see anything (didn't see actually
anything much explaining how to get parts of date out)
appropriate.
I am looking basically for something like:
select date_part('%d %m %y', now()::datetime);
As I see it currently I can only do it with something like:
select ((date_part('day',now()::datetime) || date_part('month',
now()::datetime)) || date_part('year', now()::datetime);
which is, of course, rather clumsy.
This, btw, goes about concatenation, too.
Will there be a possibility of string concatenation in 7.x so that
I don't have to put all the concats in brackets? (ie. currently I
have to: ((((X || Y) || Z ) || A) || B)
which is of course also rather clumsy and leads to lots of
typos in case of more complex expressions.
Emils
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.2 -- QDPGP 2.61a
Comment: http://community.wow.net/grt/qdpgp.html
iQA/AwUBOL5nqt0sxa1MAPWHEQLEYwCfaJA+qlrYacC/cgcGOQ3rnTkGXu4AoIeK
B0aW+djoeiR0TVIp5J/elUZL
=AB97
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] date_part - multiple values in format?
2000-03-02 15:10 date_part - multiple values in format? Emils Klotins <emils@mail.usis.bkc.lv>
@ 2000-03-02 15:46 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2000-03-02 15:46 UTC (permalink / raw)
To: Emils Klotins <emils@mail.usis.bkc.lv>; +Cc: pgsql-sql
"Emils Klotins" <emils@mail.usis.bkc.lv> writes:
> I am looking basically for something like:
> select date_part('%d %m %y', now()::datetime);
I think to_char() addresses this in 7.0, although it doesn't use
the strftime formatting conventions (blame Oracle for that ;-)).
See http://www.postgresql.org/docs/postgres/functions2569.htm
> Will there be a possibility of string concatenation in 7.x so that
> I don't have to put all the concats in brackets? (ie. currently I
> have to: ((((X || Y) || Z ) || A) || B)
> which is of course also rather clumsy and leads to lots of
> typos in case of more complex expressions.
What?
regression=# select 'a'::text || 'b'::text || 'c'::text;
?column?
----------
abc
(1 row)
6.5.3 behaves the same ...
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] date_part - multiple values in format?
2000-03-02 15:10 date_part - multiple values in format? Emils Klotins <emils@mail.usis.bkc.lv>
@ 2000-03-03 08:51 ` Emils Klotins <emils@mail.usis.bkc.lv>
1 sibling, 0 replies; 3+ messages in thread
From: Emils Klotins @ 2000-03-03 08:51 UTC (permalink / raw)
To: pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[2 Mar 00,, 10:46] Tom Lane wrote:
> "Emils Klotins" <emils@mail.usis.bkc.lv> writes:
> > Will there be a possibility of string concatenation in 7.x so that
> > I don't have to put all the concats in brackets? (ie. currently I
> > have to: ((((X || Y) || Z ) || A) || B)
> > which is of course also rather clumsy and leads to lots of
> > typos in case of more complex expressions.
> What?
> regression=# select 'a'::text || 'b'::text || 'c'::text;
> ?column?
> ----------
> abc
> (1 row)
> 6.5.3 behaves the same ...
Sorry about that. I don't remember at which version I did have
to use the form of concatenation I mentioned (6.4.x? 6.5.2?),
but yes, 6.5.3 seems to work fine without brackets.
Emils
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.2 -- QDPGP 2.61a
Comment: http://community.wow.net/grt/qdpgp.html
iQA/AwUBOL9gcN0sxa1MAPWHEQL0cwCdEvOCrVXWN6sETUkFQhxrIocwRv8AoIM5
d7tOGK/m8JJkbJ7seNk35ohk
=yLXB
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2000-03-03 08:51 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-03-02 15:10 date_part - multiple values in format? Emils Klotins <emils@mail.usis.bkc.lv>
2000-03-02 15:46 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-03-03 08:51 ` Emils Klotins <emils@mail.usis.bkc.lv>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox