0

I have a table name timelogTB and it has 5 column named; LogID(PK), EmpNo(FK), Time_In, Time_Out and Date running in form1.

Then in form2 I have a combobox where the Employee # of an employee can be selected and when I will select an Employee # the total number of days worked of that employee will display in a textbox using 2 date time picker,

the dtpicker1 is labeled dtpFrom and dtpicker2 is labeled dtpTo.

The column Date in timelogTB is only recording the date when the employee is time in using also a date time picker.

I am looking forward for a favorable answer guys, as much as possible I want you to explain it more simpler and precise because I am new in vb2010

thanks in advance!

ahmed abdelqader
  • 3,409
  • 17
  • 36
  • explain ko sa tagalog? – Jacky Montevirgen Jan 04 '17 at 08:10
  • @JackyMontevirgen: Mas ok po para mas madali maintindihan. – AtanHokage04 Jan 04 '17 at 08:22
  • Need mo ng sql code or script pra mkuha mo ung difference ng 2 dates. ung script na un ung ilalagay mo dun sa button. Pra pag select ka ng date sa datetimepicker tapos nagclick ka dun sa button matic na lalabas sa textbox ung Total number of hours or difference ng 2 dates. – Jacky Montevirgen Jan 04 '17 at 09:34
  • Are you wanting to know what the difference in days is between `dtpFrom` and `dtpTo`? If it is then have a look at [this](http://stackoverflow.com/questions/19017466/how-to-find-the-number-of-days-between-two-dates-datetimepickers). @Plutonix answer should give you what you are after. – Bugs Jan 04 '17 at 09:36

1 Answers1

0

oh kaya try mo to

txthours.text=datediff(DateInterval.hours,Time_In,Time_Out).ToString()

Assuming ung name ng textbox mo ay txthours.text. lagay mo nalang sa button

  • boss meron na po ako ganitong code. bali yung program ko kasi na ginagawa is payroll system so sa form 1 kasi doon sila nag la login ma rerecord dun yung date at time sa pag login nila. sa form 2 meron akong combo box na dun naka lagay yung mga employee #, pag click mo ng employee # lalabas yung basic info ng employee pati na din yung total days work nya within range. bali diba dito sa atin pag sahod meron mang 1-15 at 16-30 bali yun sana ang gusto kung i compute gamit yung dalawang date time picker sa form 2. – AtanHokage04 Jan 04 '17 at 23:05
  • bali extracted yung records nila sa form 1 kung ilang araw sila pumasok lets say from january 1-15 ilang araw sya pumasok. – AtanHokage04 Jan 04 '17 at 23:08
  • bale prang gusto mo mangyare pagka click mo ng employeeid sa combobox mavview na dn ung no. of working days sa form 2 basic info? – Jacky Montevirgen Jan 05 '17 at 00:54
  • oo boss ganun na nga. – AtanHokage04 Jan 05 '17 at 02:33
  • sa pag compute ko ng age at years in the company. iba naman yun sya sa registration yun ng employee bro. – AtanHokage04 Jan 05 '17 at 02:54