Results 1 to 3 of 3

Thread: Dates

  1. #1
    Join Date
    Dec 1969

    Default Dates

    I have a field named "DDate" in my database where default value equal to "=Now()" so it will generate the date and time for new records. I tried to get the sum of record on yesterday. so i wrote: <BR><BR>sqlCount = "select count(subject) as yesterday from table where DDate = (now()-1)" <BR><BR>it returns zero meaning that is no record but it&#039;s not. i think the sql is comparing the time too, which is not required in this case... My question is, how can I campare the date without camparing the time in this field? (I need the time for other purpose... so there&#039;s no way to change the format into short date) <BR><BR>I hope my question is clear enough, <BR>Please Help!!

  2. #2
    J. Paul Schmidt Guest

    Default Date and Time Fields

    Perhaps consider having a field for date with default value of Date() and a field for time with default value of Time().<BR><BR>And of course don&#039;t for get to put a # before and after a date parameter in a SQL statement.<BR><BR>Example of a date parameter:<BR>"MyDtFld = #" & MyDtVBScriptVariable & "#"<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR><BR>

  3. #3
    BAM Guest

    Default RE: Dates

    Use this:<BR><BR>Response.Write(formatdatetime(now()-1,2))

Posting Permissions

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