title: how to add seconds to string time stamp (yyyy-mm-ddTH:i:s+tz) in java
body: <p>I have a String variable called time is <strong>2016-11-30T00:06:42+05:30</strong></p>
  
  <p>and a duration <strong>32700</strong> i.e <strong>545</strong> minutes.</p>
  
  <p>I want to add duration to above string time stamp and need to calculate start time and end time. </p>
  
  <p>So i want to get StartTime:<strong>00:06</strong> and EndTime:<strong>09:05</strong>.</p>
  
  <p>I tried this but doesn't work</p>
  
  <pre><code>      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
  
        Date date = sdf.parse(startTime.toString());
        Timestamp ts_now = new Timestamp(date.getTime());
        System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;"+date);
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(ts_now.getTime());
        cal.add(Calendar.SECOND, Integer.parseInt(Value.toString()));
        Timestamp later = new Timestamp(cal.getTime().getTime());
        System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;"+later);
  </code></pre>
  
  <p>I tried with <strong>X ,Z</strong> but got error like</p>
  
  <pre><code>Exception in thread "main" java.text.ParseException: Unparseable date: "2016-11-30T00:06:42+05:30"
      at java.text.DateFormat.parse(DateFormat.java:366)
      at oneraise.radis.thread.mavenproject1.ParseJson.main(ParseJson.java:48)
  </code></pre>
  
  <p>I am new to java can anybody help me</p>
  
  <p>Thanks</p>