Print Current Time and Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stroumfs
    New Member
    • Mar 2007
    • 28

    Print Current Time and Date

    Hi!

    I would like some help. I want to print the current date and time in a form . Can anyone help?
    I am using VB2005

    thnks
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by Stroumfs
    Hi!

    I would like some help. I want to print the current date and time in a form . Can anyone help?
    I am using VB2005

    thnks
    use format along with datetime function

    Comment

    • Stroumfs
      New Member
      • Mar 2007
      • 28

      #3
      Originally posted by vijaydiwakar
      use format along with datetime function
      can you write some code because i am a beginner in VB?
      thanks

      Comment

      • vijaydiwakar
        Contributor
        • Feb 2007
        • 579

        #4
        Originally posted by Stroumfs
        can you write some code because i am a beginner in VB?
        thanks
        try this code
        Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                Me.Text = Date.Today.Date
            End Sub

        Comment

        • Stroumfs
          New Member
          • Mar 2007
          • 28

          #5
          Originally posted by vijaydiwakar
          try this code
          Code:
          Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                  Me.Text = Date.Today.Date
              End Sub
          this is fine thanks.
          if want to print the time also?

          Comment

          • vijaydiwakar
            Contributor
            • Feb 2007
            • 579

            #6
            Originally posted by Stroumfs
            this is fine thanks.
            if want to print the time also?
            Me.Text = DateTime.Now

            Comment

            • ansumansahu
              New Member
              • Mar 2007
              • 149

              #7
              Originally posted by Stroumfs
              this is fine thanks.
              if want to print the time also?

              DateTime.Now

              thanks
              ansuman

              Comment

              • Stroumfs
                New Member
                • Mar 2007
                • 28

                #8
                thanks a lot.case close

                Comment

                Working...