![]() |
| |||
| Hi everyone i am making a calendar using php and i need to store 1.event day 2.event start time 3. event end time and than showing the posted info on event page. i have added these fields in the table 1.id - auto increment primary key 2.start_date - datetime 3.start_time - time 4.end_time -time 5.posted_date -datetime just wondering if it is the right and best approach to do this or do i need to store start_date start_time and end_time field togahter or something else . hope you can understand my explanation Thanks |
| |||
| >i am making a calendar using php and i need to store >1.event day 2.event start time 3. event end time >and than showing the posted info on event page. > >i have added these fields in the table > >1.id - auto increment primary key >2.start_date - datetime >3.start_time - time If you store a start date in a datetime, then there's no need for a start time as a separate field. Put a related date and time in the same field. >4.end_time -time I'm not sure what kind of events you have in mind, but it is not that unusual that an event crosses midnight, so you need an end date and an end time, best stored in a datetime. >5.posted_date -datetime If you have to determine whether or not a given datetime (such as now()) is DURING an event, it's a lot easier to compare start_date <= now() and end_date >= now() rather than fiddling with pieces of dates and times. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |