7

I am using a Postgres database, and have a table with a date-time field. For many records, we know the year but not the date. Sometimes we know the date but not the year. And other times we know the time but not the date.

How can I store partial date information while using the date-time data type?

  • 1
    The only thing that I can think of is to split the date into day/month and year - having one or the other as NULL as necessary. – Vérace Oct 10 '15 at 8:26
  • 1
    Yep. This is one of the only times I consider a split year/month/day structure, with separate fields, to be OK. – Craig Ringer Oct 10 '15 at 11:12
1

The only thing that I can think of is to split the date into day/month and year - having one or the other as NULL as necessary. This is one of the only times I consider a split year/month/day structure, with separate fields, to be OK.

  • This is a reasonable question which deserves an answer. – Michael Green Dec 2 '15 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.