Results 1 to 4 of 4

Thread: [RESOLVED] date format

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Location
    Madrid
    Posts
    325

    Resolved [RESOLVED] date format

    Hi,
    Im sure this is one of the most common questions!! every made on VB.net!!

    But here I am making the same question!! I have done several searches but haven't found the answer! or maybe an answer I understand!

    All it is, is that I have defined a variable as a date

    Dim a as date

    But if I show this information on screen, it shows as date and time all I want to do is show this date as dd/mm/yyyy

    Hope sb can help!!
    Cheers!

  2. #2
    Addicted Member Crushinator's Avatar
    Join Date
    Jan 2006
    Location
    The Dark Side of the Moon, MD
    Posts
    179

    Re: date format

    Hey Rauland,

    When you look at the Date datatype it does say in the tooptip: "Represents an instant in time, typically expressed as a date and time of day"

    When you show the date on screen try using the .ToShortDatestring. IE:

    VB Code:
    1. Dim d As Date
    2.  
    3.         d = Now.Date
    4.  
    5.         DateButton.Text = d.ToShortDateString

    Without the .ToShortDateString the button text would show the date and 12:00 after it.
    Using Framework 2.0, VB.Net 2005.

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,383

    Re: date format

    Quote Originally Posted by Rauland
    Hi,
    Im sure this is one of the most common questions!! every made on VB.net!!

    But here I am making the same question!! I have done several searches but haven't found the answer! or maybe an answer I understand!

    All it is, is that I have defined a variable as a date

    Dim a as date

    But if I show this information on screen, it shows as date and time all I want to do is show this date as dd/mm/yyyy

    Hope sb can help!!
    Cheers!
    VB Code:
    1. Dim a as date = datetime.now
    2. messagebox.show(a.tostring("MM/dd/yyyy")

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Location
    Madrid
    Posts
    325

    Re: date format

    Cheers, thanks a lot!

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