title: Get epoch seconds for specific date in C
body: <p>How can I get the number of seconds passed since January 1, 1970 for a specific date, for example:"2017-09-14 23:24:46"</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdint.h&gt;
  #include &lt;time.h&gt;
  int main()
  {
  
      struct tm tmVar;
      time_t timeVar;
      sscanf("2017-09-14 23:24:46","%d-%d-%d %d:%d:%d",&amp;tmVar.tm_year
                          ,&amp;tmVar.tm_mon, &amp;tmVar.tm_mday,
                           &amp;tmVar.tm_hour, &amp;tmVar.tm_min, 
                           &amp;tmVar.tm_sec);
       tmVar.tm_isdst = 1;
       printf("tm_year :%d\n",tmVar.tm_year);
       printf("tm_month :%d\n",tmVar.tm_mon);
       printf("tm_day :%d\n",tmVar.tm_mday);
       printf("tm_hour :%d\n",tmVar.tm_hour);
       printf("tm_min :%d\n",tmVar.tm_min);
       printf("tm_sec :%d\n",tmVar.tm_sec);
       timeVar = mktime(&amp;tmVar);
       printf("time %d\n",timeVar);
   }
  </code></pre>
  
  <p>The output however is not what I expect:</p>
  
  <p>tm_year :2017</p>
  
  <p>tm_month :9</p>
  
  <p>tm_day :14</p>
  
  <p>tm_hour :23</p>
  
  <p>tm_min :24</p>
  
  <p>tm_sec :46</p>
  
  <p>time 1336625342</p>
  
  <p>According to <a href="https://www.epochconverter.com/" rel="nofollow noreferrer">epochconverter.com</a>, the proper value should be 1510529086.  Why am I not getting this value?</p>