title: Displaying a date on a TFT without using an array of numbers in char form
body: <p>I am trying to write the day of a month to a TFT display from a <code>DateTime</code> instance. The data for the <code>DateTime</code> instance is coming from an RTC.</p>
  
  <p>Basically, I am trying to do this:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>DateTime timenow;
  timenow = rtc.now();                      // Get and store the current RTC data as DateTime.
  tft.textWrite(timenow.day());             // This doesn't work (see below), but it shows the idea of what I am trying to do.
  </code></pre>
  
  <p><code>tft.textWrite</code> accepts a <code>char</code> as its parameter, but <code>timenow.day()</code> appears to output an <code>int</code>. The only way I have been able to get it to work (<em>which is obviously not a good way, as you will see</em>) is by making an enormous array with all of the numbers from 1 to 31 as a <code>char</code>:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>const char days[31][3] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
  </code></pre>
  
  <p>Then I used the array in my code:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>DateTime timenow;
  timenow = rtc.now();                      // Get and store the current RTC data as DateTime.
  tft.textWrite(days[timenow.day() - 1]);
  </code></pre>
  
  <p>Unfortunately, I have to do the same thing for the year, and I can't manually type in all of the years in the forseeable future into an array. It would take up memory and, besides, would be unnecessarily time-consuming.</p>
  
  <p><strong>My question is, can someone tell me how I can convert from an <code>int</code> to a <code>char</code> for use in this function without the need for the huge array?</strong></p>
  
  <p>I have tried everything from <code>String(timenow.day())</code> to <code>char(timenow.day())</code> to things like <code>char(String(timenow.day()))</code> and none of them seem to work.</p>