Welcome to Dream.In.Code
Become a VB Expert!

Join 137,269 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,464 people online right now. Registration is fast and FREE... Join Now!




convert string to date VB.net

 
Reply to this topicStart new topic

convert string to date VB.net

bjsmes
30 Dec, 2006 - 01:51 PM
Post #1

New D.I.C Head
*

Joined: 30 Dec, 2006
Posts: 2


My Contributions
Private Sub cmdconvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdconvert.Click
Dim dtmdate1 As String = ("mm dd yyyy")
Dim dtmdate2 As Date
dtmdate2 = ("mmmm dd,yyyy")

dtmdate1 = CDate(dtmdate2)

I think my dim statements are incorrect and have tried several varialtions but no luck.

My form has two textboxes and a button. Example 10/2002 needs to convert in textbox 2 to October 2, 2002 when cmdconvert button clicked.

I would appreciate any help.

Thanks
BJ
User is offlineProfile CardPM
+Quote Post

m2s87
RE: Convert String To Date VB.net
30 Dec, 2006 - 03:36 PM
Post #2

D.I.C Regular
Group Icon

Joined: 28 Nov, 2006
Posts: 390



Thanked: 1 times
Dream Kudos: 1225
My Contributions
You could use this snippet.

Or use default help to find right 1

Or make your own (something like):
CODE
a="2/10/2002"
b=split(a,"/")
c=kuu(val(b(1))) & " " b(0) & ", " & b(2)

and
CODE
function kuu(byval nr as integer) as string
  select case nr
    case 1:kuu="Jaanuar"
    case 2:kuu="Veebruar"
    case 3:kuu="Märts"
    case 4:kuu="Aprill"
    case else: kuu="Irw"
end function


Hope it helps biggrin.gif

This post has been edited by m2s87: 30 Dec, 2006 - 03:37 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 07:42PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month