Example usage for java.util Calendar getTime

List of usage examples for java.util Calendar getTime

Introduction

In this page you can find the example usage for java.util Calendar getTime.

Prototype

public final Date getTime() 

Source Link

Document

Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").

Usage

From source file:Main.java

public static int calcDateDiff(Calendar cal1, Calendar cal2) {
    long diff = cal1.getTime().getTime() - cal2.getTime().getTime();
    return (int) diff / 1000 / 60 / 60 / 24;
}

From source file:Main.java

public static Date getCurrentDate() {
    Calendar c = Calendar.getInstance();
    return c.getTime();
}

From source file:Main.java

private static Date getTimeNow() {
    Calendar c = Calendar.getInstance();
    return c.getTime();
}

From source file:Main.java

public static String toStringTime(Calendar calendar) {
    return TIME_FORMAT.format(calendar.getTime());
}

From source file:Main.java

public static Date getDate() {
    Calendar c = Calendar.getInstance();
    Date d = c.getTime();
    return d;
}

From source file:Main.java

public static String getDateString(Calendar c) {
    return defaultDateFormat().format(c.getTime());
}

From source file:Main.java

public static String getTimeString(Calendar c) {
    return defaultTimeFormat().format(c.getTime());
}

From source file:Main.java

public static int getHourOfDay() {
    Calendar cal = Calendar.getInstance();
    Date date = cal.getTime();
    return date.getHours();
}

From source file:Main.java

public static int getMinute() {
    Calendar cal = Calendar.getInstance();
    Date date = cal.getTime();
    return date.getMinutes();
}

From source file:Main.java

public static String formatCalendar(Calendar calendar) {
    return androidDateformat.format(calendar.getTime());
}