Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends,

I am developing a web application "Daily Deliverables" in which a user sees a

particular set of task of current day.

The Task are statically stored in the database accoriding to dayofWeek.

i.e for Monday 1,2,3,4 task ,for tuesday 1,4,5,6 task etc.

I am displaying a set of Task of according to the current day.

i.e if Current Day is Monday.I display Monday's Tasks.

Now,as a part of Enhancement,there are certain task which needs to be done on specific date of month. i.e on 12th date of every month.

Can you people suggest me how can i fetch a data for the user for the current day.

(This should show the current day task's along with the tasks that are specified

for current date.).

Can anyone provide the reporting database structure for this.

Thank you.
Posted

You can do this by just comparing the date component of Datetime object
e.g. DateTime.Now.Date == DATE_FETCHED_FROM_DB.DATE

and as far as designing of database is concerned, i don't think it is possible to explain the database structure here.
 
Share this answer
 
If I understood your question correctly, for the first part you could use a query like
SQL
SELECT *
FROM   Task
WHERE  DayOfWeek = DATEPART(weekday, GETDATE());

And for the second part if you have a column named Day in the same table and you have a row where Day is 12, to check if today is 12th something like:
SQL
SELECT *
FROM   Task
WHERE  Day = DATEPART(day, GETDATE());
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900