Monday, January 26, 2009

How to display date and time using vb6.0?

You may set first the TIME and DATE of your system i mean you computer because there are some cases that the time and date in your computer is not set so may set first before doing some actions inyour visual basic 6.0.
Getting the time and Date in your computer basically its very easy.
First is to put two labels in your form label1 and label2 that is the name of the two labels and then after that i want you put 1 command button inside you form which is command1. And double click your command button put this code inside command1_click() label1.caption is equal to Date and lablel2.caption is equal to Time after that run your program and try to click your command button and it will automatically appear the time and date. You can download my example below.. Thats all!















You can download my example below.


Download File

22 comments:

  1. No problem.. be follower of my blog..

    ReplyDelete
  2. it can display the time but no interval hahhahaha

    ReplyDelete
  3. what about dtpicker??
    how can you pick a date and time and display it in the datagrid???

    _meSTIer_

    ReplyDelete
  4. how do i write coding for the time difference using vb program for example using the 24-hours format, from 1800hours to 2000hours(the difference is 2 hours) and from 2300hours to 0400hours(the difference is 5 hours)?

    p/s: help me A.S.A.P

    ReplyDelete
  5. bay maaung adlaw bag-o paman gud ko sa vb6 ma ngutana unta ko kung unsaon pag capture sa time kay nag himo man gud ko ug payroll system. tapos un na lang ang akong problema.. hope you can help me with this problem. tnx poh..
    taga Cagayan pud ko. Sa Carmen amoa..
    >Aaron

    ReplyDelete
  6. @Aaron:

    Example you have label1.

    label1.caption = time
    label1.caption = date

    ReplyDelete
  7. how can i show the date without the button???
    i wanna use form_load

    ReplyDelete
  8. Private Sub Form_Load()
    label1.caption = time
    label1.caption = date
    End Sub

    ReplyDelete
  9. Private Sub Timer1_Timer()
    Label1.Caption=FormatDateTime(Now, vbLongDate)
    Label2.Caption=FormatDateTime(Now, vbLongTime)
    End Sub

    ReplyDelete
  10. how can i see the time counting ..?

    ReplyDelete
  11. how to create automatic time and date in vb

    ReplyDelete
  12. fix ung oras d gumagalaw

    ReplyDelete
    Replies
    1. just add timer. change interval to 1000
      ex:
      Private Sub Timer3_Timer()
      label1.Caption = Time
      End Sub

      Delete
  13. You need to add a timer control to make your time and date moving. Set time interval to 1000.

    ReplyDelete
  14. brod meron kang sample vb code for DTR? log in, for AM, noon break out and in, then log out for afternoon. tapos generates reports after a day or a week...

    ReplyDelete
  15. meroon po bang code pag CLICK mo mag kakapture sa LABEL ung time and date?

    parang DTR pag Pasok mo at Pag labas mo ay mayroong mag ka-capture sa label box.. (REX STUDENT PO AKO NEED HELP)

    ReplyDelete
  16. time interval sample

    Private Sub Timer1_Timer()
    lblTime.Caption = FormatDateTime(Now, vbLongTime)
    Timer1.Interval = 1000
    End Sub

    call the Timer1_Timer in your form_Load() so that the time will be visible

    ReplyDelete
  17. how to display the date which is stored in database onto a label ?

    ReplyDelete

 

blogger templates | Make Money Online