Date/Time Fields SQLServer

Results 1 to 3 of 3

Thread: Date/Time Fields SQLServer

  1. #1
    Join Date
    Dec 1969

    Default Date/Time Fields SQLServer

    Maybe someone here can shed some light on this.<BR><BR>I&#039;m creating a really simple time-sheet application.<BR><BR>In the DB I have 3 date time fields. One is for the time-in, one is for the actual date of the day, and the other is for the time-out.<BR><BR>When I use it to clock in, it works fine. The time is stored properly in its field, as is the date of the day I&#039;m working. However, when I clock out, it stores the time along with the date"01/01/1900" in the same field as the time.<BR><BR>There is no code that tell it to put any date in the field, and I am simply putting the system time in with a &#060;%=Time%&#062;.<BR><BR>Can anyone tell me why it puts that default date in with time. It doesn&#039;t do that with the clock-in code, only the clock-out.<BR><BR>The code is below...<BR><BR>When i clock in...<BR><BR>set objRS = Server.CreateObject("ADODB.Recordset")<BR>objRS.Op en "tblTime",objConn,,adLockOptimistic,adCmdTable<BR> <BR>objRS.AddNew <BR>objRS("Employee") = Request.Form("Name")<BR>objRS("Date") = Date<BR>objRS("TimeIn") = Request.Form("Time")<BR>objRS("TimeInComments") = Request.Form("Comments")<BR>objRS.Update<BR><BR><B R>Then the clock out...<BR><BR>SQLSignOut = "UPDATE tblTime SET TimeOut = &#039;" & Request.Form("Time") & "&#039;, TimeOutComments = &#039;" & Request.Form("Comments") & "&#039; WHERE Employee = &#039;" & Request.Form("Name") & "&#039; AND Date = &#039;" & Date & "&#039;"<BR> <BR>set objRS = objConn.Execute(SQLSignOut)<BR>set objRS = nothing<BR><BR>Thanks in advance,<BR><BR>BCH

  2. #2
    Join Date
    Dec 1969

    Default ASPFAQs, category Dates and Times

    The link to the ASPFAQs is at the top right corner of this very page.<BR><BR>Your problem is addressed by an FAQ in that category.<BR><BR>One big mistake you are making is separating the date and time into two fields.<BR><BR>Just have a TimeIn DATE*and*TIME field as will as a TimeOut DATE*and*TIME field. Much cleaner, in the long run. Honest.<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Date/Time Fields SQLServer

    Data Type is Datetime and that says it all. Not Date not Time but Both!<BR>Follow the link Bill gave you

Posting Permissions

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