title: Changing date entered in textbox to another format using javascript asp.net
body: <p>I've been looking at forums and tutorials all day, and I can't seem to figure this out. I'm 100% new to asp.net and web design (html, etc); I have been using winforms and vb.net for a few months now.</p>
  
  <p>I have a textbox (ID=DOBTextbox) on a page, and I'm trying to implement javascript code that, when the textbox text length is at least 6 chars (or better yet, can be evaluated as a date), the text changes to a specific date format (preferably MMM dd, yyyy, but I'd be willing to use a built-in javascript date converter function that gets it close). I want to use javascript because I want it to be client-driven.</p>
  
  <p>Following many of the examples along these lines, I understand that I need to create a function in my source file, and I can add an attribute to my code-behind file.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function reformatDate(inputDate) {
      var outputDate = inputDate.toString();
      return outputDate;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And in my code-behind:</p>
  
  <pre><code>DOBTextBox.Attributes.Add("onblur", "reformatDate('" &amp; DOBTextBox.Text &amp; "')")
  </code></pre>
  
  <p>However, nothing happens when I leave the textbox.</p>
  
  <p>Note: I used "onblur" because I kept trying things out. My first preference is an event that fires when the user changes the text of the textbox. Also, I used ".tostring()" in my function because I got an error saying that todatestring() wasn't recognized (I think todatestring() output is closer to the format I'd like).</p>
  
  <p>Thanks in advance for any help!!!</p>