Page 1 of 1

date question

Posted: Mon Oct 23, 2006 8:06 am
by speedy33417
I have a table field picture_date that stores a date as (for example) 2006-12-31. There are some old pictures (pre digital camera era...) where the exact date of the picture taken is not known.
At the moment I make up dates that are close to the original date. Of course, it's not the best solution for me.

I was thinking of using zeros for information that is unknown. Like:
1998-11-00 would mean November 1998.
1998-00-00 would mean sometime in 1998.

Would the zeros generate any error? The field is set for date data type (YYYY-MM-DD)

The next problem would be when the the year is unclear and would only want to output a decade. I was thinking:
1970-99-99 would mean sometime in the 70's.

Any thoughts?

Posted: Mon Oct 23, 2006 11:41 am
by Cameri
Of course it will generate errors and things you may not expect, simply put it this way: it's not a valid date.
If you are going to provide time spans when you don't know the date, why not make it like this, two fields in your db, one specifying the beginning of your time span, and the second one the end, if the both are the same then you got an exact date, or just leave the second one empty, whichever you prefer.

Re: date question

Posted: Tue Oct 24, 2006 9:42 am
by Yossarian
speedy33417 wrote:I have a table field picture_date that stores a date as (for example) 2006-12-31. There are some old pictures (pre digital camera era...) where the exact date of the picture taken is not known.
At the moment I make up dates that are close to the original date. Of course, it's not the best solution for me.

I was thinking of using zeros for information that is unknown. Like:
1998-11-00 would mean November 1998.
1998-00-00 would mean sometime in 1998.

Any thoughts?
I'd be pragmatic about it.

Just show Month / Year next to all photos.

Then on a further screen, say if the user really wants to know more about a photo, then show the real date, ie 27th Nov 2006

Now, on the ones you dont know the exact date, guess the year and the month. Put their date as always being the first.

Now - on your further screen as described above, if a photo has 1st add an extra text line "this photo may have been taken any time during this month....." and give as much/little info as you want.

It means 1:~30 photos will have this tag though...

Heres a thought:

Why not have an extra field in your database "scan" then
//pseudo : when isset(scan) show a text message
much better way round the problem.

In fact,
if scan ==true and date = yyyy-01-01 then you can print "taken sometime in year yyyy"

Posted: Wed Oct 25, 2006 8:07 pm
by speedy33417
I ended up changing the data type to varchar, but keep the same format to store the data like when it was date before.
Then used my first idea to generate missing date format.
My photo album doesn't need a search by date function for pictures, so I'm not missing out on anything. I wrote a funtion to deal with the new date structure and I'm good to go.
Seemed like an easier way to do it.

:wink:

Posted: Thu Oct 26, 2006 6:14 am
by Yossarian
speedy33417 wrote:My photo album doesn't need a search by date function for pictures, so I'm not missing out on anything.
Then you have taken an option off the table.