Another date/time question

Results 1 to 2 of 2

Thread: Another date/time question

  1. #1
    Join Date
    Dec 1969

    Default Another date/time question

    I think this now warrants it&#039;s own post since it is unrelated to my original question.<BR><BR>If I store my dates and times in the database as one (e.g. 12/30/2002 11:00:00 AM), how do I extract only the date from this in my SELECT statement?<BR><BR>I tired using Datepart, but it doesn&#039;t seem to work. My code is:<BR><BR>"SELECT * FROM tblUserAppointments WHERE StartDateTime = &#039;"12/30/2002"&#039;"<BR><BR>My StartDateTime field would have a value of something like 12/30/2002 11:00:00 AM. Thanks.

  2. #2
    Join Date
    Dec 1969

    Default Answered in other thread...

    Either use CONVERT or use a range:<BR><BR> WHERE StartDateTime &#062;= &#039;12/30/2002&#039; AND StartDateTime &#060; &#039;12/31/2002&#039;<BR><BR>I think you will find that the range version (above) is faster than the double convert.<BR><BR>But see also the other thread where I can&#039;t figure out how <BR> WHERE StartDateTime = &#039;12/30/2002&#039;<BR>would find an appointment on 1/2/2003, in any case. Even though it&#039;s in the same week.<BR><BR>

Posting Permissions

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