title: Working with Dates in Sapui5
body: <p>How can I get the current date, current year, current month, and current week in sapui5? This is the code I started with:</p>
  
  <pre><code>var oType = new sap.ui.model.type.Date();
  oType = new sap.ui.model.type.Date({ source: {}, pattern: "MM/dd/yyyy" });
  </code></pre>
  
  <p>I have no idea where to go from here. Any help would be greatly appreciated.</p>
  
  <p>EDIT: How do I get the following javascript function into a sapui5 table?</p>
  
  <pre><code>function addZero(i) {
      if (i &lt; 10) {
          i = "0" + i;
      }
      return i;
  }
  
  function dateFunction() {
      var today = new Date();
      var dd = addZero(today.getDate());
      var MM = addZero(today.getMonth() + 1);
      var yyyy = today.getFullYear();
      var hours = addZero(today.getHours());
      var min = addZero(today.getMinutes());
      var sec = addZero(today.getSeconds());
      var ampm = hours &gt;= 12 ? 'PM' : 'AM';
      hours = hours % 12;
      hours = hours ? hours : 12; // the hour '0' should be '12'
  
      today = MM + '/' + dd + '/' + yyyy + "  " + hours + ":" + min + ":" + sec + " " + ampm;
  }
  </code></pre>