Jason 8
Jason 8

Reputation: 221

How to code two Sundays inside two weeks differently?

I am saving days in my database but my problem is I shouldn't be able to save the same day.

It successfully saves because they both read "Sunday". How can I code such that the Sunday in the database saved last week is different from "Sunday" today, and so on?

Upvotes: 1

Views: 54

Answers (1)

Yaakov Ellis
Yaakov Ellis

Reputation: 41490

Record meta-data for each save giving the date on which you are saving it, not the day of the week.

Then before you save a new day, verify that you have not yet saved a record for that date.

Upvotes: 1

Related Questions