sql - Conversion from string "5:53:10 PM" to type 'Integer' is not valid -


i want time diff between dr(3) , dr(4)

sub workinghours()     cmd = new sqlcommand("select * dtrtable employeeid = '" & me.textbox3.text & "' , timeout not null", con)     dr = cmd.executereader     while dr.read         gettimein = dr(3)         gettimeout = dr(4)          while gettimein < gettimeout             gethours = gethours + 1             gettimein = gettimein + 1         end while         gettimein = nothing         gettimeout = nothing     end while     dr.close()     me.textbox8.text = gethours     gethours = nothing end sub 

you can use timespan class this, need strip off am/pm part.

dim ts1 = timespan.parse(dr(3).tostring.replace(" am", "").replace(" pm", "")) dim ts2 = timespan.parse(dr(4).tostring.replace(" am", "").replace(" pm", ""))  if ts1 > ts2  'do end if 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -