|
-
Dec 12th, 2002, 09:39 PM
#1
Thread Starter
Lively Member
how to convert string to date in vb.net
hi guys
i waant to know how to convet the string to date in vb.net ..
i fany body have code please let me know...
sandin
-
Dec 12th, 2002, 11:02 PM
#2
there is a CDate() function
there is probably a better way though
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Dec 12th, 2002, 11:28 PM
#3
Thread Starter
Lively Member
hi MrPolite
i used that but it doen`t work properly.. could u give me the sample code for easy understanding..
sandin
-
Dec 13th, 2002, 12:10 AM
#4
Frenzied Member
Try this
VB Code:
DateTime.Parse("december 12, 2005").ToShortDateString()
Dont gain the world and lose your soul
-
Dec 13th, 2002, 12:15 AM
#5
Sleep mode
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object _
, ByVal e As System.EventArgs) Handles MyBase.Load
Dim datetime As DateTime = Now.Today
'string date
MsgBox(datetime.ToString)
'string date converted to date type
MsgBox(CDate(datetime))
End Sub
-
Dec 13th, 2002, 12:24 AM
#6
Thread Starter
Lively Member
hi guy,
if my string is "20021212" then i want to convert it in Date format
will u plz. tell ?? how??
sandin
-
Dec 13th, 2002, 12:35 AM
#7
Sleep mode
is your string always fix-string ??inother words , it contains 8 chara ?
-
Dec 13th, 2002, 01:08 AM
#8
Thread Starter
Lively Member
yes , it is 8 chat and a number..
-
Dec 13th, 2002, 01:29 AM
#9
Sleep mode
Look at the string in the code and after msgbox is shwon , this means it's converted to date type.
VB Code:
Dim datetime As String = "20021213"
datetime = datetime.Insert(4, "/")
MsgBox(CDate(datetime.Insert(7, "/")))
-
Dec 13th, 2002, 01:38 AM
#10
Frenzied Member
You might have to write your own function to convert that format or you can change the format to 2002/12/12, then you can use
VB Code:
MessageBox.Show(DateTime.Parse("2002/12/12").ToLongDateString())
Dont gain the world and lose your soul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|