|
-
Sep 20th, 2002, 03:42 AM
#1
Thread Starter
Hyperactive Member
Date Format -Urgent
hi to all
i have text box named it as txtFdate
Code:
<input id="txtFromDate" tabindex="3" type="text" onchange="OnChangeClientSide()" size="12" runat="server" />
here i am just entering the value like 01-05-2002. So i need to Chage this into DateFormat so that i can insert into Database.
is there anything like txtFromDate.Format('mm/dd/yyyy')
any Help...?
-
Sep 20th, 2002, 01:11 PM
#2
Fanatic Member
Re: Date Format -Urgent
Originally posted by buddu
is there anything like txtFromDate.Format('mm/dd/yyyy')
any Help...?
DateTime dt = Convert.ToDateTime(txtFromDate.Text);
John
-
Sep 21st, 2002, 01:48 AM
#3
Thread Starter
Hyperactive Member
Still i am getting the Errors.
I got the following Error Message
Code:
Compiler Error Message: BC30037: Character is not valid.
-
Sep 21st, 2002, 02:04 AM
#4
Try changing the - to / and see if that fixes it. Format wont really work (i think) since its already a string not a number.
Last edited by Edneeis; Sep 24th, 2002 at 03:13 PM.
-
Sep 23rd, 2002, 06:47 AM
#5
Thread Starter
Hyperactive Member
hi Edneeis
I got this error ("BC30037: Character is not valid") While Compiling the program. I mean i wrote coding in Command Click Envent. But While running in First Time I got this it menas while compile it is not recognizing no?
-
Sep 24th, 2002, 03:14 PM
#6
So you are saying that if the value you enter is like this: 01/05/2002 it still gives you the error? Which line gives the error?
-
Sep 25th, 2002, 12:31 AM
#7
Thread Starter
Hyperactive Member
Code:
Line 15: Sub Clk(obj as Object,E as EventArgs)
Line 16: Dim s as String
Line 17: s=Convert.ToDateTime(txtFromDate.value);
Line 18: lblMsg.text=s
Line 19:
-
Sep 25th, 2002, 01:50 AM
#8
Shouldn't it be more like this:
VB Code:
Sub Clk(obj as Object,E as EventArgs)
Dim s as Date
s=Convert.ToDateTime(txtFromDate.Text);
lblMsg.text=s.ToShortDateString
-
Sep 25th, 2002, 06:44 AM
#9
Thread Starter
Hyperactive Member
agin the problem comes to the next spep
BC30456: 'ToShortDateString' is not a member of 'String'
Code:
Line 16: Dim s as String
Line 17: s=Convert.ToDateTime(txtFromDate.value)
Line 18: lblMsg.text=s.ToShortDateString
Line 19:
Line 20:
-
Sep 25th, 2002, 02:28 PM
#10
Originally posted by buddu
agin the problem comes to the next spep
BC30456: 'ToShortDateString' is not a member of 'String'
Code:
Line 16: Dim s as String
Line 17: s=Convert.ToDateTime(txtFromDate.value)
Line 18: lblMsg.text=s.ToShortDateString
Line 19:
Line 20:
That is correct ToShortDateString is not a member of string, its a member of date. I changed the declaration to date that was the root of the problem. Look back at the post notice:Dim s as Date
-
Sep 25th, 2002, 11:28 PM
#11
Thread Starter
Hyperactive Member
Thanq Very much. .
It is working... Great help.
-
Sep 25th, 2002, 11:48 PM
#12
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
|