Here you can find the source of toDate(final String date, final String time)
Parameter | Description |
---|---|
date | date string as yyyy-MM-dd |
time | time string as HH:mm |
public static Date toDate(final String date, final String time)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w ww . j a v a 2 s. c o m*/ * @param date date string as yyyy-MM-dd * @return Date representation */ public static Date toDate(final String date) { return toDate(date, "00:00.00.000"); } /** * @param date date string as yyyy-MM-dd * @param time time string as HH:mm * @return Date representation */ public static Date toDate(final String date, final String time) { try { return new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(date + " " + time); } catch (ParseException e) { throw new RuntimeException(e); } } }