Here you can find the source of toDate(Calendar cal)
toDate (cal):
convert Calendar to Date
Parameter | Description |
---|---|
cal | Calendar |
public static Date toDate(Calendar cal)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.TimeZone; public class Main { /**//from ww w .jav a 2s. c o m * <code>toDate (date): </code> convert SQL Date to Date * @param date SQL Date * @return Date */ public static Date toDate(java.sql.Date date) { if (date == null) return null; Date javaDate = new Date(date.getTime()); return javaDate; } /** * <code>toDate (cal):</code> convert Calendar to Date * @param cal Calendar * @return Date */ public static Date toDate(Calendar cal) { if (cal == null) return null; return cal.getTime(); } /** * <code>getTime (timezone):</code> get the time now * @param zone time zone * @return Calendar instance */ public static Calendar getTime(TimeZone zone) { return Calendar.getInstance(zone); } }