2

I have a datetime field that saves data as a string. But I want to save it as a date type. Is there any date data type in Postgre sql that accepts this kind of date format? February 1, 2016, 10:17 AM

1
  • Default date-time format for Postgres is yyyy-mm-dd hh:mn:ss.ms. For example select '1812-10-23 11:12:13.111'::timestamp will be accepted everywhere. Commented Feb 1, 2016 at 3:16

2 Answers 2

2

You can use TIMESTAMP, DATE or TIME field to save your date, but date variables/ fields in postgres doesnt save format.

http://www.postgresql.org/docs/9.4/static/datatype-datetime.html

You have to use postgres function to_date(text, text) to convert from string to date

http://www.postgresql.org/docs/9.4/static/functions-formatting.html

Sign up to request clarification or add additional context in comments.

Comments

1

You have TIMESTRAMP and TIMESTAMP WITH TIME ZONE.

You can have all the information here: http://www.postgresql.org/docs/9.4/static/datatype-datetime.html

Comments

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.