Datetime help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QVZM?=

    Datetime help

    Hi,
    I've need some info regarding datetime conversions..
    I've a string in the below format'"dd/mm/yyyy"..I want it to be converted to
    Datetime object with the date format as "mm/dd/yyyy"
    I've used the below code..

    Dim provider As IFormatProvider
    provider = New System.Globaliz ation.CultureIn fo("en-US", True)
    drnewRow("Inv_D ate_Detail") = DateTime.ParseE xact("21/11/2007",
    "dd/MM/yyyy", provider).ToSho rtDateString()

    This workds fine if my current culture in regional settings is "en-US"..
    but fails when I move my current culture to 'en-GB"..

    I want a generic solution to this..
    how shud i convert a "dd/mm/yyyy" to "mm/dd/yyyy" in vb/net?
  • Mark Rae [MVP]

    #2
    Re: Datetime help

    "AVL" <AVL@discussion s.microsoft.com wrote in message
    news:1A3714CD-4306-4225-97E5-A9BB402F2B33@mi crosoft.com...
    I want a generic solution to this..
    how should i convert a "dd/mm/yyyy" to "mm/dd/yyyy" in vb/net?
    Try this:
    drnewRow("Inv_D ate_Detail") = DateTime.ParseE xact("21/11/2007",
    "dd/MM/yyyy", Nothing).ToShor tDateString()


    --
    Mark Rae
    ASP.NET MVP


    Comment

    Working...