title: Convert the time string of UTC to IST time in C language
body: <p>I am looking for the UTC (<em>from RFC3339 format</em>) to IST conversion in C program. But I could not find any generic way to convert the time.</p>
  
  <p><a href="https://stackoverflow.com/questions/56624057/how-to-convert-rfc-3339-date-time-to-ist">Here</a>, I found the shell script to convert the UTC time (<em>in RFC3339 format</em>) to IST and I am trying to implement in C code.</p>
  
  <p>From the script, I can't find the equivalent way for the statement
   <code>newdate=$(TZ=IST date -d "$formatT UTC-5:30")</code> in C code.</p>
  
  <p>So, I did time diff of <code>-5:30</code> with the GMT time as shown in below snippet. But, it is not working as expected.</p>
  
  <pre><code>int main(int argc, char *argv[])
  {  
      const char *utctime = "2019-07-24T11:47:33";
      struct tm tm = {0};
      char s[128] = {0};
  
      if (NULL == (strptime(utctime, "%Y-%m-%dT%H:%M:%S", &amp;tm))) {
          printf("strptime failed\n");
      }
  
      printf("IST Time : %2d:%02d\n", ((tm.tm_hour-5)%24), tm.tm_min-30);
  
  }
  </code></pre>
  
  <p>Kindly, guide me to do the task in C code that the script does.</p>