|
-
Jan 12th, 2005, 03:03 PM
#1
Thread Starter
Addicted Member
Converting date from textbox to DateTime
I have a date in a textbox that came from a popup Calendar control. Now I would like to take the date i returned to this textbox and update it to an SQL Server, but the problem is that the value have to be DateTime and not text.
Can anyone tell me how to do this please.
Thanks.
-
Jan 12th, 2005, 04:34 PM
#2
Addicted Member
Re: Converting date from textbox to DateTime
VB Code:
Dim dteDate as date
dteDate = ctype(textbox1.text, date)
If you want to check if it is a date first, you can use the IsDate() function.
-
Jan 12th, 2005, 04:35 PM
#3
Frenzied Member
Re: Converting date from textbox to DateTime
System.Convert
or construct a new datetime from the string date time
Magiaus
If I helped give me some points.
-
Jan 12th, 2005, 04:56 PM
#4
Thread Starter
Addicted Member
Re: Converting date from textbox to DateTime
Thanks to the both of you for the replies. I tried both already, but it was really my own stupidity that prevented it from working. The field I was converting was disabled and so the value being converted was '' and thus wouldnt work.
Thanks again guys.
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
|