Re: [SQL] Datetime field

From: "Jose' Soares" <jose(at)sferacarta(dot)com>
To: Henrik Denseje Pedersen <HenrikP(at)mail(dot)ikasths(dot)dk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Datetime field
Date: 1998-09-17 13:28:40
Message-ID: 36010E88.AD85EA1A@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
> --

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Joppich 1998-09-17 14:12:47 Turn autocommit off ?
Previous Message Henrik Denseje Pedersen 1998-09-17 10:46:51 Datetime field