title: How to change and format date with C
body: <p>I want to increase date using days... For example if todays is 27.05.2015 and I add 6 days it should print 3.06.2015</p>
  
  <p>Here is my try:</p>
  
  <pre><code>   time_t now;
      struct tm *tm;
  
      now = time(0);
      if ((tm = localtime (&amp;now)) == NULL) {
          printf ("Error extracting time stuff\n");
          return 1;
      }
  
      printf ("%02d-%02d-%04d\n", tm-&gt;tm_mday + 6, tm-&gt;tm_mon, tm-&gt;tm_year+1900);
  </code></pre>
  
  <p>This will outpyt:</p>
  
  <blockquote>
    <p>33-05-2015</p>
  </blockquote>
  
  <p>Also How I can format date like this:</p>
  
  <blockquote>
    <p>27-JUN-2015</p>
  </blockquote>