2

I have a table in PostgreSQL created by SQLAlchemy just like that:

Column('dt_index_tex', DateTime)

If I insert a date like '21-01-2014', when querying I get the date in different format:

SELECT dt_index_tex from table;
    dt_index_tex        |        
------------------------+
 2014-01-21 00:00:00    |

how could i query in DMY format ?

I know in PostgreSQL I have the to_char function, but I want something to do with SQLAlchemy, so I don't have to change the format all times I query the table. I guess I have to try a different way of creating the table, but don't know what is missing.

2
  • 3
    What is the code you are using in SQLAlchemy to query the date? If you create it using SQLAlchemy and query through SQLAlchemy, SQLAlchemy should handle the formatting for you and return it as a datetime object (not a string). Commented Jan 22, 2014 at 16:42
  • you're right dude, so silly, thank you ! Commented Jan 22, 2014 at 18:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.