title: get current date with localtime_s
body: <pre><code>time_t t = time(0);
  struct tm *now = localtime(&amp;t);
  </code></pre>
  
  <p>With the code above, I can simply get the date like this:</p>
  
  <pre><code>int yearNow = (now.tm_year + 1900), monthNow = (now.tm_mon + 1), dayNow = now.tm_mday
  </code></pre>
  
  <p>but Visual Studio 2015 gives me error on <code>localtime</code>, ask me to use <code>localtime_s</code> instead. Below is my code with using <code>localtime_s</code>:</p>
  
  <pre><code>time_t rawtime;
  struct tm now;
  localtime_s(&amp;now, &amp;rawtime);
  </code></pre>
  
  <p>But the problem is, how do I get the actual current year, month, day in <code>int</code>?
  I print the variable with this code: <code>cout &lt;&lt; now.tm_year &lt;&lt; " " &lt;&lt; now.tm_mon &lt;&lt; " " &lt;&lt; now.tm_mday;</code>
  but the output is <code>-1 -1 -1</code></p>