Date conversion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KK

    #1

    Date conversion

    Hi,

    How can we convert string to date in VB.NET?

    I will get date in a string "5/24/2005"
    By using date operations I want to convert this date into another
    string "24-May-2005". Not by using arrays.

    Pls help.

    Regards.

  • Herfried K. Wagner [MVP]

    #2
    Re: Date conversion

    "KK" <krallabandi@gm ail.com> schrieb:[color=blue]
    > How can we convert string to date in VB.NET?
    >
    > I will get date in a string "5/24/2005"
    > By using date operations I want to convert this date into another
    > string "24-May-2005". Not by using arrays.[/color]

    Take a look at 'Date.Parse', 'Date.ParseExac t' and 'Date.ToString' .

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Cor Ligthert

      #3
      Re: Date conversion

      KK,

      In addition to Herfried, the Microsoft VisualBasic namespace has very strong
      convert methods, those do not need you to use some of the very basic .Net
      functions. This is especially for dates, where for the conversion is CDate.

      http://msdn.microsoft.com/library/de...conversion.asp

      (When you have to do something with dates don't forget to look at the date
      functions from VBNet, the are extremly handy)

      I hope this helps,

      Cor


      Comment

      • Cor Ligthert

        #4
        Re: Date conversion

        KK,

        I forgot this to write, date conversions are very depending on cultures.

        By instance has the United States a very local datetime format not used at
        much places outside the USA and English speaking Candada, except in a Coca
        Cola culture way.

        Therefore is the use of any datetime string in Net, which uses in my opinion
        extremely well the culture/language settings of the computer, something
        that you would have to avoid as much as possible.

        Just my thought,

        Cor


        Comment

        Working...