I need the VB codings to get the current Time and Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sreekandan
    New Member
    • Nov 2006
    • 98

    I need the VB codings to get the current Time and Date

    Hi
    Now im doing one project to maint the login and logout time of the organization.
    So I need the VB codings to get the Current time and Date with detail.
    So kindly reply me anyone.
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Originally posted by sreekandan
    Hi
    Now im doing one project to maint the login and logout time of the organization.
    So I need the VB codings to get the Current time and Date with detail.
    So kindly reply me anyone.
    Hi there,

    Kindly refer to below code segment, hope it helps. Good luck & Take care.

    Code:
    Dim dtCurrentDate, tmCurrentTime, nDateTime
    
      dtCurrentDate = Format(Now, "dd/mm/yyyy")
      tmCurrentTime = Format(Now, "hh:mm:ss am/pm"
      nDateTime = Format(Now)
    VB - Format function

    Comment

    • kishored
      New Member
      • Dec 2006
      • 17

      #3
      Originally posted by sreekandan
      Hi
      Now im doing one project to maint the login and logout time of the organization.
      So I need the VB codings to get the Current time and Date with detail.
      So kindly reply me anyone.
      Hi sreekandan, try this code

      DateTime.now

      For example if you want to display the date and time in a Label then it is
      Label1.Caption = DateTime.now

      Comment

      • sreekandan
        New Member
        • Nov 2006
        • 98

        #4
        Originally posted by kishored
        Hi sreekandan, try this code

        DateTime.now

        For example if you want to display the date and time in a Label then it is
        Label1.Caption = DateTime.now


        Hi kishore
        I need the codings to get the Time and Date in two separate LabelBox(one is for time and another one is for date).Im expecting ur reply.So kindly reply me.

        Comment

        • rockford333
          New Member
          • Sep 2006
          • 15

          #5
          Originally posted by sreekandan
          Hi kishore
          I need the codings to get the Time and Date in two separate LabelBox(one is for time and another one is for date).Im expecting ur reply.So kindly reply me.

          Try this
          label1=format$( now"DD-MM-YY")
          label2=format$( now"HH:MM:SS")
          this wat u want

          Comment

          • kishored
            New Member
            • Dec 2006
            • 17

            #6
            Originally posted by sreekandan
            Hi kishore
            I need the codings to get the Time and Date in two separate LabelBox(one is for time and another one is for date).Im expecting ur reply.So kindly reply me.
            Hi sreekandan,
            If you want to display them seperately, then try this code:

            Label1.caption = Date
            Label2.caption = Time

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by rockford333
              Try this
              Code:
              label1=format$(now[U], [/U]"DD-MM-YY")
              label2=format$(now[U], [/U]"HH:MM:SS")
              this wat u want
              Note, you left out the commas.

              Also, it might be better to stick to generic named formats like "Short Date" rather than hard-coding the format.

              Comment

              Working...