Results 1 to 5 of 5

Thread: [RESOLVED] Change date format

  1. #1

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Resolved [RESOLVED] Change date format

    How do i change the date format from MM/dd/yyyy to dd/MM/yyyy?

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Change date format

    What do you mean? In a computer? In a string? In a DateTime? Or what?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Re: Change date format

    the string is in dd/MM/yyyy format, but whenever I convert it using this code:
    vb.net Code:
    1. DATE1 = Date.ParseExact(tmp, "dd/MM/yyyy", Nothing)
    It takes it into mm/dd/yyyy format for some strange reason.

    Also gives me error on dates like 5/4/2010

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Change date format

    It doesn't take it into any format. A Date object doesn't have any format at all. The IDE displays any and all dates in M/dd/yyyy format but that is just how the IDE displays it. It doesn't mean anything about the Date value itself, which is simply a number. No Date object has any format at all. It's only when you display the Date to the user, i.e. convert it to a String, that format is an issue. Rememebr this: a Date object has NO FORMAT at all. It's only when converting a Date to a String or a String to a Date that format is an issue.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Re: Change date format

    Oh ok. Thanks for clearing that up for me.

Tags for this Thread

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