Best way to store weekly event in MySQL?

Posted by mazin k. on Stack Overflow See other posts from Stack Overflow or by mazin k.
Published on 2010-05-14T17:46:45Z Indexed on 2010/05/14 18:14 UTC
Read the original article Hit count: 220

Filed under:
|

I have a table of weekly events that run on certain days of the week (e.g. MTWTh, MWF, etc.) and run on a certain time (e.g. 8am-5pm). What's the best way to store day of week information in MySQL to make retrieving and working with the data easiest? My CakePHP app is going to need to retrieve all events happening NOW().

For time of day, I would just use TIME. For days of the week, I had considered a 7-bit bitfield, a varchar ("MTWThFr" type deal) for the days of the week, but both of those seem like clunky solutions (the varchar being clunkier).

Any suggestions?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about dayofweek