Java String to Time getTime(String sDateTime, String eDateTime)

Here you can find the source of getTime(String sDateTime, String eDateTime)

Description

get Time

License

Open Source License

Declaration

public static int getTime(String sDateTime, String eDateTime) throws ParseException 

Method Source Code


//package com.java2s;
import java.text.*;

public class Main {
    public static int getTime(String sDateTime, String eDateTime) throws ParseException {
        SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
        java.util.Date ssDateTime = myFormatter.parse(sDateTime);
        java.util.Date eeDateTime = myFormatter.parse(eDateTime);
        long l = (eeDateTime.getTime() - ssDateTime.getTime());
        long day = l / (24 * 60 * 60 * 1000);
        return (int) day;
    }/* w w w.  j  a v  a 2s  .c  om*/
}

Related

  1. getTime(String file)
  2. getTime(String parrten)
  3. getTime(String pattern)
  4. getTime(String pattern)
  5. getTime(String s)
  6. getTime(String time)
  7. getTime(String time)
  8. getTimeDate(String time)
  9. getTimes(String startTime, String endTime)