Questions about javascript dates
<p>I have 2 questions about dates.</p>

<p>The first one is how can I get the "AM/PM" from a date in Javascript?</p>

<p>the second question is say I have this code</p>

<pre><code>    var convertedStartDate = new Date(dueDate);
    var month = convertedStartDate.getMonth() + 1;
    var day = convertedStartDate.getDate();
    var year = convertedStartDate.getFullYear();
     var shortDueDate = month + "/" + day + "/" + year;
</code></pre>

<p>Now as you can see I want always this format mm/dd/yyyy</p>

<p>So I am wondering if say dueDate is 1/9/2010 (mm/dd/yyyy) but the person entered it in as dd/mm/yyyy(some other format version of date).</p>

<p>would </p>

<p>month = 1 
day = 9
year = 2010</p>

<p>Or do I have to tell it somehow to always convert into mm/dd/yyyy? Or does it do is own format so that it always would get the right order? Ie it does not matter what order they put the date in it would always get 9 as the day.</p>
