Date & Time issue

Results 1 to 2 of 2

Thread: Date & Time issue

  1. #1
    Join Date
    Dec 1969

    Default Date & Time issue

    Hello everybody,<BR><BR>i am building a event calendar application in with SQL server as backend database. I am storing the eventstartdate,eventstarttime,eventenddate,eventen dtime in the SQLDB.<BR>Here is a sample record of the same<BR>EventStartDate:2004-01-21 00:00:00.000 EventStartTime:2004-01-21 13:10:00.000 EventEndDate:2004-01-21 00:00:00.000 EventEndTime:2004-01-21 13:25:00.000<BR><BR>As there will be lot of events in a day I need to avoid a clash say for example for 21 Jan 04 if there is a event Meeting with MS guys between 10:00 AM to 11 PM..If I try to add one more event for the same day between 10:30 AM to 10:45 AM I need to check if there are any entries for that date..How can I do that.<BR><BR>Thanks in advance

  2. #2
    Join Date
    Dec 1969

    Default You'd have to run a query...

    ...that checks that neither the new start date/time nor the new end date/time are between any of the other records&#039; start and end date/times.<BR><BR>SELECT EventID FROM Events WHERE ({NewStart} &#062;= EventStart AND {NewStart} &#060;= EventEnd) OR ({NewEnd} &#062;= EventStart AND {NewEnd} &#060;= EventEnd)<BR><BR>This would select all those events where the new start and end dates clash. If this returns no records, you know it&#039;s fine to add the new event.<BR><BR>{NewStart} and {NewEnd} would have to be the actual values of course.<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts