pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDatetime field
2+ messages / 2 participants
[nested] [flat]
* Datetime field
@ 1998-09-17 10:46 Henrik Denseje Pedersen <HenrikP@mail.ikasths.dk>
0 siblings, 1 reply; 2+ messages in thread
From: HenrikP@mail.ikasths.dk @ 1998-09-17 10:46 UTC (permalink / raw)
To: pgsql-sql
Hi all...
In a database i have created a datetime field.. its works fine, but is
there someway i can get the result back in "normal" date format
instead of this "Wed Aug 19 00:00:00 1998 MET DST".
I need to use it in my program, so i need it in the normal datetime format:
wich is : 08-19-98 00:00:00
By the way, im programming in Perl, so if anyone know a funktion to
convert it back, that could be helpfull too
Yours Sincerely
Henrik Pedersen
--
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Datetime field
@ 1998-09-17 13:28 Jose' Soares <jose@sferacarta.com>
parent: Henrik Denseje Pedersen <HenrikP@mail.ikasths.dk>
0 siblings, 0 replies; 2+ messages in thread
From: Jose' Soares @ 1998-09-17 13:28 UTC (permalink / raw)
To: Henrik Denseje Pedersen <HenrikP@mail.ikasths.dk>; +Cc: pgsql-sql
1. If you define it as TIMESTAMP instead of DATETIME you have the format
as you desire.
2. If you set DateStyle TO 'ISO', you may have the same result. Take a
look:
prova=> create table tbl ("Time Stamp" timestamp, "Date Time"
datetime);
CREATE
prova=> insert into tbl values (current_timestamp, 'now');
INSERT 82754 1
prova=> \x
turned on expanded table representation
prova=> set datestyle to 'POSTGRES';
SET VARIABLE
prova=> select * from tbl;
Field | Value
-- RECORD 0 --
Time Stamp| 1998-09-17 17:19:48+02
Date Time | Thu 17 Sep 17:19:48 1998 CEST
(1 row)
prova=> set datestyle to 'ISO';
SET VARIABLE
prova=> select * from tbl;
Field | Value
-- RECORD 0 --
Time Stamp| 1998-09-17 17:19:48+02
Date Time | 1998-09-17 17:19:48+02
(1 row)
I hope this help you
Jose'
Henrik Denseje Pedersen wrote:
>
> Hi all...
>
> In a database i have created a datetime field.. its works fine, but is
> there someway i can get the result back in "normal" date format
> instead of this "Wed Aug 19 00:00:00 1998 MET DST".
>
> I need to use it in my program, so i need it in the normal datetime format:
> wich is : 08-19-98 00:00:00
>
> By the way, im programming in Perl, so if anyone know a funktion to
> convert it back, that could be helpfull too
>
> Yours Sincerely
>
> Henrik Pedersen
> --
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-09-17 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-09-17 10:46 Datetime field Henrik Denseje Pedersen <HenrikP@mail.ikasths.dk>
1998-09-17 13:28 ` Jose' Soares <jose@sferacarta.com>
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