title: Convert date time into correct date time format of dd-MMM-yyyy HH:MM in dojo
body: <p>I am getting my current date time in below format</p>
  
  <pre><code>Fri Oct 04 2019 13:48:00 GMT+0530 (India Standard Time)
  </code></pre>
  
  <p>But i need this in below format </p>
  
  <pre><code>04-Oct-2019 19:18
  </code></pre>
  
  <p>I am getting first format </p>
  
  <pre><code>exports.date = function formatDate(vpDateObj) {
    var vpDate = locale.parse(dateUtils.toString(vpDateObj), {
      datePattern: "dd-MMM-yyyy HH:mm",
      selector: "date"
    });
    alert(vpDate);
    alert(convert(vpDate));
    return vpDate ? vpDate.toString(vpDate) : " ";
  };
  </code></pre>
  
  <p>and i am trying to convert into proper format like below </p>
  
  <pre><code>function convert(str) {
    var date = new Date(str),
      mnth = ("0" + (date.getMonth() + 1)).slice(-2),
      day = ("0" + date.getDate()).slice(-2);
    hours = ("0" + date.getHours()).slice(-2);
    minutes = ("0" + date.getMinutes()).slice(-2);
    return [date.getFullYear(), mnth, day, hours, minutes].join("-");
  }
  </code></pre>
  
  <p>But here <code>GMT+530 hours</code> is not getting added in time.</p>
  
  <p>Please help </p>