views:

151

answers:

1

I am creating a task list with number of hours worked to be entered against each task along each day of the week. So if a user clicks on a particular week dates then I need to get all the days' dates into hidden fields. Then I will use them to identify the which hours entry is against which date and insert them into the database. So for this how can I use jquery date picker plugin to get these dates in a week. Please suggest a way as I have been searching for this for long. Thanks in advance

+2  A: 

If you fetch a Date from your datepicker, you could use getDay to fetch the current week day (0 being Sunday), and calculate the offsets from there.

Sample Code

David Hedlund
Sorry. I want to pick the dates of 7 days in the selected week.
Enjoy coding
yes. but I take it you use the regular datepicker, where the user actually clicks a date...? then based on that, you can check whether what day in the week, whichever week it is, and calculate the rest of the dates from there. if `selectedDate.getDay()` is 3, the user has picked a Wednesday, and you can calculate the Monday using `selectedDate.setDate(-2)` etc
David Hedlund
Thanks for that ... i am trying it out .. in the mean time can you paste any sample code available. Thanks again for ur help..
Enjoy coding
sure, see my edited post.
David Hedlund
Thank you veryt much. This is why I love to say i am a SO member. Thanks again..That helped me a lot. I will keep in touch with you.
Enjoy coding