473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Is it not datestyle that determines date format output?

The way PostgreSQL deals with the date format is confusing me...
I need PostgreSQL to return dates from selects at this format: "dd/mm/yyyy",
but it insists in returning it as "yyyy-mm-dd". I say "insists" cause I had
already set datestyle to "European" (in postgresql.conf) which represents
the format I want... I checked it executing: "SHOW DATESTYLE" and I got:
DateStyle
-----------
ISO with European conventions

When inserting dates, PostgreSQL understands very well my date format like
"dd/mm/yyyy", but it is also important to get the date like that.
I think it's possible, but I had tried all the tricks I knew or I could
retrieve from manual...

Any ideas?
Thank you all.
Netto

Nov 12 '05 #1
3 5098
Check the datestyle settings in the manual. Also look at to_char, with that
you can format the data any way you like,

Maybe: set DateStyle = sql,european;

On Thu, Dec 11, 2003 at 03:35:39PM -0200, Netto wrote:
The way PostgreSQL deals with the date format is confusing me...
I need PostgreSQL to return dates from selects at this format: "dd/mm/yyyy",
but it insists in returning it as "yyyy-mm-dd". I say "insists" cause I had
already set datestyle to "European" (in postgresql.conf) which represents
the format I want... I checked it executing: "SHOW DATESTYLE" and I got:
DateStyle
-----------
ISO with European conventions

When inserting dates, PostgreSQL understands very well my date format like
"dd/mm/yyyy", but it is also important to get the date like that.
I think it's possible, but I had tried all the tricks I knew or I could
retrieve from manual...

Any ideas?
Thank you all.
Netto




---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
--
Martijn van Oosterhout <kl*****@svana.org> http://svana.org/kleptog/ (... have gone from d-i being barely usable even by its developers
anywhere, to being about 20% done. Sweet. And the last 80% usually takes
20% of the time, too, right?) -- Anthony Towns, debian-devel-announce


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/3ij3Y5Twig3Ge+YRAhw1AJ9As1IVgBioKHy2N2uOY1PMlwNlqw Cg1iJo
CjBcWBNo1uwN/IdSTpqPk7Q=
=iu2n
-----END PGP SIGNATURE-----

Nov 12 '05 #2
On Thu, 11 Dec 2003, Netto wrote:
The way PostgreSQL deals with the date format is confusing me...
I need PostgreSQL to return dates from selects at this format: "dd/mm/yyyy",
but it insists in returning it as "yyyy-mm-dd". I say "insists" cause I had
already set datestyle to "European" (in postgresql.conf) which represents
the format I want... I checked it executing: "SHOW DATESTYLE" and I got:
DateStyle
-----------
ISO with European conventions

When inserting dates, PostgreSQL understands very well my date format like
"dd/mm/yyyy", but it is also important to get the date like that.
I think it's possible, but I had tried all the tricks I knew or I could
retrieve from manual...


This may be a dup (it arrived in my inbox on 11 Dec 2003), but I'll reply
just in case.

What flavor of Postgresql are you running? I'll assume 7.4.

I'm assuming you've read this section of the docs:

http://www.postgresql.org/docs/curre...-datetime.html

Have you tried entering:

set DateStyle='SQL, dmy';

ISO style makes it the yyyy-mm-dd format, SQL makes it the other.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #3
""scott.marlowe"" <sc***********@ihs.com> escreveu na mensagem
news:Pi*************************************@css12 0.ihs.com...
This may be a dup (it arrived in my inbox on 11 Dec 2003), but I'll reply
just in case.
What flavor of Postgresql are you running? I'll assume 7.4.
I'm assuming you've read this section of the docs:
http://www.postgresql.org/docs/curre...-datetime.html
Have you tried entering:
set DateStyle='SQL, dmy';
ISO style makes it the yyyy-mm-dd format, SQL makes it the other.


Hey Scott,... thank you for the tips,... I forgot mentioning the PostgreSQL
version I'm using... its 7.3.2. I read the documentation section you
suggested, and it really solves my problem, since I upgrade postgresql to
7.4.

Netto
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
5
by: Jean-Max Reymond | last post by:
I want to have the date in french format for my postgres 7.4 database. reading the documentation, three ways to get it. 1. set datestyle to 'postgres,european'; for each session, it works OK 2....
0
by: UBI | last post by:
Vorrei suggerire una funzione completa per la differenza fra due date. (questo è codice freeware, niente di illegale) La funzione seguente permette il calcolo di una differenza precisa tra due...
2
by: Bill Moran | last post by:
Boy, I'm just full of questions today ... Is there a way to provide different persistent settings for DateStyle for different databases within the same cluster? Simply put, I've got two...
4
by: hph | last post by:
Okay, another trivial matter that I can't solve. I have a variable - $lastdate - that is the latest date any record in a MySQL database was updated. Its MySQL format is TIMESTAMP. If I say I...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
3
by: dave | last post by:
I need to compute an expiration date based on the number of hours, days, or months purchased. The expiration date needs to be expressed in minutes something like '1260481600'. How can I get the...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
8
by: yashiro | last post by:
Hello i Have a database in SQLserver. I am using php to connect to it and to retrieve data from that database. I have a table with a column (DATATIME) where i do : $result =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.