title: Create 30 min slots from given date and time
body: <p><strong>I have time in below format</strong> </p>
  
  <blockquote>
    <p>2015-10-28T18:37:04.899+05:30</p>
  </blockquote>
  
  <p><strong>I have to create slots in below format</strong></p>
  
  <blockquote>
    <p>11.00AM - 12.00PM 28/10/15</p>
    
    <p>12.00PM - 1.00PM 28/10/15</p>
    
    <p>1.00PM - 2.00PM 28/10/15</p>
  </blockquote>
  
  <pre><code>String timeValue = "2015-10-28T18:37:04.899+05:30";
          StringTokenizer  stringTokenizer = new StringTokenizer(timeValue,"T");
          String dateValue = stringTokenizer.nextElement().toString();
          String endDateValue = "2015-10-30";
          String restString= stringTokenizer.nextElement().toString();
          StringTokenizer secondTokeniser = new StringTokenizer(restString,":");
          String hours = secondTokeniser.nextElement().toString();
          String minutes = secondTokeniser.nextElement().toString();
          hours = String.valueOf(Integer.parseInt(hours) + 2);
          if (Integer.parseInt(minutes) &gt; 30){
              minutes = "00";
          }else{
              minutes = "30";
          }
  
          String amOrPm = null;
          if(Integer.parseInt(hours) &lt; 12){
              amOrPm = "AM";
          }else{
              amOrPm = "PM";
              hours = String.valueOf(getHoursValue(Integer.parseInt(hours)));
          }
          String time1 = hours + ":" + minutes + " " + amOrPm;
          String time2 = "12" + ":" + "00" + " AM ";
          String format = "yyyy-mm-dd hh:mm a";
  
  
          SimpleDateFormat sdf = new SimpleDateFormat(format);
  
          try {
              Date dateObj1 = sdf.parse(dateValue + " " + time1);
              Date dateObj2 = sdf.parse(endDateValue + " " + time2);
              Logger.d(TAG, "Date Start: " + dateObj1);
              Logger.d(TAG, "Date End: " + dateObj2);
              long dif = dateObj1.getTime();
              while (dif &lt; dateObj2.getTime()) {
                  Date slot = new Date(dif);
                  Log.d(TAG, "Hour slot = " + slot);
                  dif += 1800000;
              }
          }catch (ParseException ex){
              ex.printStackTrace();
          }
  </code></pre>
  
  <p><strong>By the above code I am getting below output</strong> </p>
  
  <blockquote>
    <p>Wed Jan 28 20:00:00 IST 2015</p>
    
    <p>Wed Jan 28 20:30:00 IST 2015</p>
    
    <p>Wed Jan 28 21:00:00 IST 2015</p>
    
    <p>Wed Jan 28 21:30:00 IST 2015</p>
    
    <p>Wed Jan 28 22:00:00 IST 2015</p>
    
    <p>Wed Jan 28 22:30:00 IST 2015</p>
    
    <p>which is in 24 hours format</p>
  </blockquote>
  
  <p><strong>I want the below out put format</strong> </p>
  
  <blockquote>
    <p>11.00AM - 12.00PM 28/10/15</p>
    
    <p>12.00PM - 1.00PM 28/10/15</p>
    
    <p>1.00PM - 2.00PM 28/10/15</p>
  </blockquote>
  
  <p>Can any one please help me regarding this </p>