خرید بک لینک

Vote count: 0

public class DateTime {
    public static java.util.LinkedList searchBetweenDates(java.util.Date startDate, java.util.Date endDate) 
    {
       java.util.Date begin = new Date(startDate.getTime());
        java.util.LinkedList list = new java.util.LinkedList();
        list.add(new Date(begin.getTime()));
        java.util.Date end = new Date(endDate.getTime());
       endDate.setTime(endDate.getTime() + 24*3600*1000);
        while(begin.compareTo(endDate)<0)
        {
            list.add(new Date(begin.getTime()));

            Timestamp timestamp = new Timestamp(new Date().getTime());
            int total=720;
            Calendar cal = Calendar.getInstance();
            cal.setTime(begin);

            for(int d=0; d<=total; d++)
            {
            cal.add(Calendar.MINUTE, 2);
            timestamp = new Timestamp(cal.getTime().getTime());
            begin = new Date(begin.getTime() + 86400000);

            System.out.println(timestamp);

            }
            cal.setTime(endDate);

        }
        retu list;
    }

  public static void main( String[] args )throws Exception
  {
      java.util.Scaer input = new java.util.Scaer(System.in);
      System.out.println("Enter the Start Date: dd/mm/yyyy");
      String begin = new String();
      begin = input.nextLine();

      System.out.println("Enter the End Date: dd/mm/yyyy");
      String end = new String();
      end = input.nextLine();

      java.util.LinkedList hitList = searchBetweenDates(
            new java.text.SimpleDateFormat("dd/MM/yyyy").parse(begin),
            new java.text.SimpleDateFormat("dd/MM/yyyy").parse(end));

      String[] comboDates = new String[hitList.size()];
      for(int i=0; i<hitList.size(); i++)
          comboDates[i] = new java.text.SimpleDateFormat("dd/MM/yyyy ").format(((java.util.Date)hitList.get(i)));

      for(int i=0; i<comboDates.length; i++)
      input.close();
    }

Here in this program I tried to print Date and Time-stamp of differences 2 mins.I want 720 records per day so I have taken total as 720, is there any other way rather than this so that I can just enter start date and end date and it will print that Date range data multiplied by 720 each date for a new date.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 26 فروردين 1395 ساعت: 12:08

صفحه بندی