Results 1 to 3 of 3

Thread: [RESOLVED] format date

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    Resolved [RESOLVED] format date

    Hi,
    I need to convert a date as follows please.

    strPayDate = "31/01/2006";
    DateTime dtPayDate = DateTime.Parse(strPayDate.ToString()); //returns "01/31/2006"

    I would like to get dtPayDate which is of type DateTime:
    dtPayDate = "31/01/2006"

    p.s. i tried using ToShortDateString but this seems to return a string and not a date and so can not assignn it to DateTime dtPayDate

    How is this possible please?
    Thanks

  2. #2
    Hyperactive Member josep's Avatar
    Join Date
    Sep 2006
    Location
    Barcelona
    Posts
    409

    Re: format date

    A date is a date does not matter the way in which it is stored on the system; VB.NET is using regional settings to show you the date, you can change this regional settings or use the globalization class change it for your application.

    If you want to show the date on a textbox, you can use the format function to format it to the desired output. But then it will become an string not a date.
    Useful links:DB connection strings ADO.NET VB.NET Tutorials

    • Don't forget to close the thread if solved
    • If this post helps you rate it

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    Re: [RESOLVED] format date

    Solved.
    Thanks

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