How to save date (yyy-MM-dd) and time (hh:mm:ss) in Postgresql?

Asked

Viewed 70 times

1

I need to store in the Postgresql database the date and time that a particular record has been changed or inserted, but when creating this column I was in doubt about which format to choose, timestamp with time zone | timestamp without time zone | Date, my need is that in the bank I can save that way the column 2017-09-18 09:12:00, then which should I choose?

  • 1

    And why don’t you store a date instead of storing one string? There whenever you need it you use it as you wish. Or even store the timestamp that you should always go alone, it makes no sense to use it with anything else. You know what a timestamp?

  • Could be, today the field is like Date but it is necessary to store the time together, so I do not know what would be the right option for this

  • I have the impression that this solves, right?

  • 1

    Resolve yes @bigown

  • Thank you so much for the @rray tip

  • @bigown, in which case I close my question?

  • I’ve already closed :) ...

  • @bigown, Just one more question, I selected timestamp without time zone, what I should put as length for that column?

  • I would need to see this better.

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.