For example I have:
- Start date (1 Column)
- End date (1 Column)
- Weekday: mon, tues, wed, thur, fri, sat, sun (1 Column)
How do I define the week so I can store the above data in a 3 field in the database?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From a processing perceptive, storing those 3 fields in a single cell is not recommended.
You would have to go through unnecessary overhead to encode and decode the data while writing to and reading from the table and also would need to perform additional data-type conversions!
You could try something like : ,,
Where : 124 for Monday, Tuesday and Thursday. But as discussed above, it is not the right way to go about it..
Ideally you have 3 columns for each item and store the weekdays in a number of formats:
<weekday_list_to_run_the _scheduled_tasks>: Where we encodeMonday,asTuesday and Thursday
124. Requires the most processing.Say we store
<weekday_list_to_run_the _scheduled_tasks> = Monday-X-X-Thursday-Fri-X-Sundayas1001101.Then through 7 AND-ing operations we find the days on which the
schedule should run.
Eg.