Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Urgent: how to convert string into date in vb.net

Urgent: how to convert string into date in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharptutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ashish Kumar Vyas
    wrote on last edited by
    #1

    Hi, can u tell me how to convert strings like 12/06/2020 ,12-06-2007 etc in date format. ex: 12/06/2007-------> 12-Dec-2006 12-06-2007-------> 12-Dec-2006 thanks & regards

    G C V 3 Replies Last reply
    0
    • A Ashish Kumar Vyas

      Hi, can u tell me how to convert strings like 12/06/2020 ,12-06-2007 etc in date format. ex: 12/06/2007-------> 12-Dec-2006 12-06-2007-------> 12-Dec-2006 thanks & regards

      G Offline
      G Offline
      Georg Kohler
      wrote on last edited by
      #2

      Check this out _ I never used it myself - but stumbled over it over the last few days when trying to fix my late binding issue .. It copied out of the Help index Imports System Public Class ChangeTypeTest Public Shared Sub Main() Dim d As [Double] = - 2.345 Dim i As Integer = CInt(Convert.ChangeType(d, GetType(Integer))) Console.WriteLine("The double value {0} when converted to an int becomes {1}", d, i) Dim s As String = "12/12/98" Dim dt As DateTime = CType(Convert.ChangeType(s, GetType(DateTime)), DateTime) Console.WriteLine("The string value {0} when converted to a Date becomes {1}", s, dt) End Sub 'Main End Class 'ChangeTypeTest

      1 Reply Last reply
      0
      • A Ashish Kumar Vyas

        Hi, can u tell me how to convert strings like 12/06/2020 ,12-06-2007 etc in date format. ex: 12/06/2007-------> 12-Dec-2006 12-06-2007-------> 12-Dec-2006 thanks & regards

        C Offline
        C Offline
        CKnig
        wrote on last edited by
        #3

        DateTime.TryParseExact method or TryParse/Parse with the right culture

        V 1 Reply Last reply
        0
        • A Ashish Kumar Vyas

          Hi, can u tell me how to convert strings like 12/06/2020 ,12-06-2007 etc in date format. ex: 12/06/2007-------> 12-Dec-2006 12-06-2007-------> 12-Dec-2006 thanks & regards

          V Offline
          V Offline
          V 2
          wrote on last edited by
          #4

          Hi, Try this one Dim d As Date Dim s As String s = "17-12-2007" d = CType(s, Date) s = Format(d, "d MMMM yyyy") MsgBox(s) Hope this helps :laugh:

          1 Reply Last reply
          0
          • C CKnig

            DateTime.TryParseExact method or TryParse/Parse with the right culture

            V Offline
            V Offline
            VB 8 0
            wrote on last edited by
            #5

            Hi, This is perfect Date.Today.ToString("d-MMM-yyyy") to get the way we want. u have to use , dd-M-YY (Format) like this for this search in net . dvs

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups