#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0

    Get user input date


    Do anyone hav code for getting user input date from a txtbox in dd/MM/yyyy format. I've already change the regional setting in control panel but i still can't get dd/MM/yyyy format. Pls anyone help!!! Help needed urgently
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Location
    Pakistan
    Posts
    8
    Rep Power
    0
    Make the object of Date class (built in .NET) then wrtie dateObject.now.... You can also check the format from date class.there are so many formats available.
  4. #3
  5. A mule with a spinning wheel.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Wales
    Posts
    118
    Rep Power
    17

    Using the 'DateTime' object


    Use the 'DateTime' object I am not sure what language you are using, so here are some examples for VB.NET and C#:

    Code:
    [Visual Basic]
    Dim MyString As String = "20/12/02"
    Dim MyDateTime As DateTime = DateTime.Parse(MyString)
    Console.WriteLine(MyDateTime)
    [C#]
    string MyString = "20/12/02";
    DateTime MyDateTime = DateTime.Parse(MyString);
    Console.WriteLine(MyDateTime);
    The input format depend on you CultureInfo settings. You will probably not need to change this as it but if you do it is in System.Globalisation.

    Hope this helps

    Dave

IMN logo majestic logo threadwatch logo seochat tools logo