PDA

View Full Version : Date problem


Santhi
07-01-02, 06:00
How date is stored in this database?

My regional settings is in dd/mm/yyyy format
when i am selecting current_date it is
giving '01/07/2002'.

I am having table with dailyid and reporteddate
as columns.I am getting the values for the reporteddate
from the frontend(textbox value).Textbox value
is in dd/mm/yyyy format.

when i am inserting values like '28/06/2002'
it is inserting values into the database as
i typed. But when i am inserting '07/06/2002' and
'01/07/2002'.It is inserting date values
as '06/07/2002' and '07/01/2002'.
What's the problem?
Why it is saving like this?Is there any solution
for this?

eperich
07-02-02, 12:46
I don't know whats going on there.

But the best thing is you save the date with

YYYY-MM-DD

With this format you don't have any problems

I have written an conversion layer cause my datestyle is
DD.MM.YYYY

so you can give in every date you need and send it through your conversion layer

one big effort. solution forever

r937
07-02-02, 22:08
to answer your question, santhi, date are stored as integers or floating-point numbers

what you meant to ask was, "how do i insert dates, and how do i get them back out?"

i agree with eperich, you will never have any trouble if you specify your dates in ISO standard format, yyyy-mm-dd

check http://www.postgresql.org/idocs/index.php?datatype-datetime.html for more info

rudy
http://rudy.ca/