Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

time field

0 views
Skip to first unread message

beginer

unread,
Jul 21, 2008, 1:01:18 PM7/21/08
to
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


Gordon Burditt

unread,
Jul 21, 2008, 2:33:26 PM7/21/08
to
>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.

beginer

unread,
Jul 22, 2008, 10:18:32 PM7/22/08
to
Hi Gordon,

Thanks for the suggestions .

beginer.

0 new messages