I'm using this code to place Time\Date stamps in specific Access Columns:

Dim conn,strsql,sql_update,ssn,cps,hdDate,TOD,PageDate,h
h=hour(now())

ssn = "Select SSN From CWCT07 where SSN = '" & Request.Form("SSN") & "'" 

If _
 (Request.form("PageDate")) = "1/30/2007" And "h" < "12" _ 
Then _
   sql_update = "Update CWCT07 Set Jan30AM = '" & Request.Form("hdDate") & "' where ssn = '" & Request.form("ssn") & "'" _
Else If _
  (Request.form("PageDate")) = "1/30/2007" And "h" > "12" _
Then _
   sql_update = "Update CWCT07 Set Jan30PM = '" & Request.Form("hdDate") & "' where ssn = '" & Request.form("ssn") & "'" _
Else If _
  (Request.form("PageDate")) = "2/05/2007" And "h" < "12" _
Then _
   sql_update = "Update CWCT07 Set Feb02AM = '" & Request.Form("hdDate") & "' where ssn = '" & Request.form("ssn") & "'" _
Else _
response.write(DATE()) _ 
End If

I get the correct answer:
1/30/2007 7:49:19 AM
But it is going into the Jan30PM column, not the Jan30AM Column. Shouldn't it be reading 7 as less than 12? Is there anyway to parse for the AM/PM part of the Date Function??

Thanks

problem is not with the date function.

you are comparing the string "h" to the string "12"
"h" < "12" is always going to return false

you need to compare your variable h to the number 12

h < 12

Thanks. That works. :)

Now I just need to make sure the time is a 24 hour clock....not AM/PM?

problem is not with the date function.

you are comparing the string "h" to the string "12"
"h" < "12" is always going to return false

you need to compare your variable h to the number 12

h < 12

it should be 24 hour time

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.