Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-2008, 06:01 PM
beginer
 
Posts: n/a
Default time field

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




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-21-2008, 07:33 PM
Gordon Burditt
 
Posts: n/a
Default Re: time field

>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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-23-2008, 03:18 AM
beginer
 
Posts: n/a
Default Re: time field

Hi Gordon,

Thanks for the suggestions .

beginer.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:31 PM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.