Results 1 to 12 of 12

Thread: Date Format -Urgent

  1. #1

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446

    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...?
    prasad

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774

    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

  3. #3

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    Still i am getting the Errors.

    I got the following Error Message
    Code:
      
    Compiler Error Message: BC30037: Character is not valid.
    prasad

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  5. #5

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    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?
    prasad

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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?

  7. #7

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    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:
    prasad

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Shouldn't it be more like this:
    VB Code:
    1. Sub Clk(obj as Object,E as EventArgs)
    2.    Dim s as Date
    3.    s=Convert.ToDateTime(txtFromDate.Text);
    4.    lblMsg.text=s.ToShortDateString

  9. #9

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    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:
    prasad

  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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

  11. #11

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    Thanq Very much. .

    It is working... Great help.
    prasad

  12. #12
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    No problem, anytime.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width