views:

164

answers:

1

What would be a good hash-algorithm to hash dates, e.g. 24/12/09 and 31/10/89?

The dates would range from about year 1950 to 2050.

Could using the unix timestamp somehow, be possible?

+7  A: 

You could use the number of days instead of the number of seconds since the start of the Unix Epoch. Just calculate:

<unix timestamp> / 86400
Gumbo
are you sure that % is good operation, i would prefer divison.
ralu
@ralu: You’re right, it must be division and not modulo since I’m interested in the full days an not the remaining seconds.
Gumbo
This is fine but it won't address the OP needs: "I want to store pairs of dates and then check if **exactly that pair** has been entered before".
Alix Axel