searching dates

  • Thread starter Thread starter Saso Zagoranski
  • Start date Start date
S

Saso Zagoranski

Hi!

This is not exactly a C# question but I don't know where else to post it...

I'm making an application where the user keeps track of it's art
collection... I'm also trying
to implement a search, where the user could search specific arts based on
defined criteria.
The problem is when it comes to date of origin. The year of an artwork could
be 1970, 1982 or 1780 but it could also be 16. century or something
similar...

Does anyone have any experience with this? Should I limit the way the data
is entered or do you have better ideas?

Thanks,
Saso
 
Saso,

In this case, I would have a range of dates to search between. If they
want to search for 16th century art, then they would search from 1/1/1500 -
1/1/1600.

However, you will need to do a little modification on how you store the
dates. It isn't always known when an art piece is created, you might just
know parts of the date. Because of this, I would store the date in a
database table (or whatever you are storing it in). In addition to the
date, I would store how many parts of the date you know are accurate (month,
day, year, etc, etc). Your 15th century art, for example, would have a date
in the middle of what it knows is accurate. If you know the century is
accurate and only that, you would place a date of say 1/1/1550 in as the
date. If you know a year and a month is accurate, then you would have the
15th of that month as the day in the date, (say March of 1549 would be
stored as 3/15/1549).

Then, the user would craft it's query appropriately. If they want 16th
century art, then they would look in the date range of 1/1/1501 - 1/1/1600.

Hope this helps.
 
Back
Top