Results 1 to 5 of 5

Thread: Time

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Time

    Code:
           Dim time As String
            time = Now.ToString("HH:mm")
    This is code I have been using already.

    I have format, for example


    08:00

    And how to get format

    8:00

    Thanks!

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Time

    Use "h:mm" instead of "HH:mm".
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Re: Time

    Yes, that's it, i tried with H:mm, and it didn't work, and h:mm work. Thanks!

    And how to check is in some textbox current date every second, and if it is display in messagebox ("yes")
    ?
    Last edited by hepeci; Mar 8th, 2010 at 04:11 PM.

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Time

    You need to read the documentation. It's all there in MSDN library:
    http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

    "how to check is in some textbox current date every second": that's what timers are for. You need a timer, set its interval to 1000ms (1 second) and in the timer.tick event handler, you read the current date (Date.Now) and get the date part of it, compare that to your date.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Time

    Quote Originally Posted by hepeci View Post
    Code:
           Dim time As String
            time = Now.ToString("HH:mm")
    This is code I have been using already.

    I have format, for example


    08:00

    And how to get format

    8:00

    Thanks!
    HH signifies 24 hour clock time. So to keep that format
    Code:
            Dim TimeStr As String = Date.Now.ToString("HH:mm").TrimStart("0"c)
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width