Converts a Calendar to a Date - Android java.util

Android examples for java.util:Date Convert

Description

Converts a Calendar to a Date

Demo Code


//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    /**/*from ww w  .  j a  v  a2s  .  c  o  m*/
     * Converts a Calendar to a Date
     *
     * @param cal calendar to convert
     * @return a date
     */
    public static Date calendarToDate(Calendar cal) {
        return new Date(cal.getTimeInMillis());
    }
}

Related Tutorials