Check different date formats
<p>I have function:</p>

<pre><code>sample(date){
  //operations, for example add one week (7 days) 

  return date;
}

var one = new Date('2012-07-16');
var two = new Date('07/16/2012');

var new = sample(one); // or sample(two)

var day = new.getDate();
var month = new.getMonth();
var year = new.gerYear();

alert(day + month + year);
</code></pre>

<p>and now i would like show this date, but how can i check format this date? 
For example:</p>

<pre><code>alert(sample(one));
</code></pre>

<p>should show me date with format <strong>2012-07-23</strong>
and if </p>

<pre><code>alert(sample(one));
</code></pre>

<p>should show me <strong>07/23/2012</strong></p>

<p>but how can i check format current date? is this possible?</p>
