Here you can find the source of parseDateTime(String date, String time)
Parameter | Description |
---|---|
date | a parameter |
time | a parameter |
public static long parseDateTime(String date, String time)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long parseDateTime(String date, String time) { long long0 = 0l; String maxTime = date + " " + time + ":00:000"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); try {//w w w.j a va2 s .c o m Date day = sdf.parse(maxTime); return day.getTime(); } catch (ParseException e) { e.printStackTrace(); } return long0; } public static String getTime(java.util.Date date) { return format(date, "HH:mm:ss"); } public static String format(java.util.Date date, String format) { String result = ""; try { if (date != null) { java.text.DateFormat df = new java.text.SimpleDateFormat(format); result = df.format(date); } } catch (Exception e) { } return result; } public static String format(java.util.Date date) { return format(date, "yyyy/MM/dd"); } }