Example usage for java.util Calendar MINUTE

List of usage examples for java.util Calendar MINUTE

Introduction

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

Prototype

int MINUTE

To view the source code for java.util Calendar MINUTE.

Click Source Link

Document

Field number for get and set indicating the minute within the hour.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Calendar japanCal = new GregorianCalendar(TimeZone.getTimeZone("Japan"));
    japanCal.set(Calendar.HOUR_OF_DAY, 10); // 0..23
    japanCal.set(Calendar.MINUTE, 0);
    japanCal.set(Calendar.SECOND, 0);

    Calendar local = new GregorianCalendar();
    local.setTimeInMillis(japanCal.getTimeInMillis());
    int hour = local.get(Calendar.HOUR); // 5
    int minutes = local.get(Calendar.MINUTE); // 0
    int seconds = local.get(Calendar.SECOND); // 0
    boolean am = local.get(Calendar.AM_PM) == Calendar.AM; // false
}

From source file:Main.java

public static void main(String[] args) {
    Date myDate;//from   www . j  a va  2  s. c  o  m
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.MONTH, 9);
    cal.set(Calendar.DATE, 24);
    cal.set(Calendar.YEAR, 2013);
    cal.set(Calendar.HOUR, 13);
    cal.set(Calendar.MINUTE, 45);
    cal.set(Calendar.SECOND, 52);
    myDate = cal.getTime();
    System.out.println(myDate);
}

From source file:Main.java

public static void main(String[] args) {
    Calendar calTokyo = Calendar.getInstance();

    calTokyo.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));

    System.out.println(/*from ww  w.ja v  a2  s  . c om*/
            "Time in Tokyo: " + calTokyo.get(Calendar.HOUR_OF_DAY) + ":" + calTokyo.get(Calendar.MINUTE));
}

From source file:Main.java

public static void main(String[] args) {
    Calendar calParis = Calendar.getInstance();

    calParis.setTimeZone(TimeZone.getTimeZone("Europe/Paris"));
    System.out.println(//from  w ww  . j a  va 2s  . c om
            "Time in Paris: " + calParis.get(Calendar.HOUR_OF_DAY) + ":" + calParis.get(Calendar.MINUTE));

}

From source file:Main.java

public static void main(String[] args) {
    Calendar now = Calendar.getInstance();

    System.out.println("Current full date time is : " + (now.get(Calendar.MONTH) + 1) + "-"
            + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR) + " " + now.get(Calendar.HOUR_OF_DAY) + ":"
            + now.get(Calendar.MINUTE) + ":" + now.get(Calendar.SECOND) + "." + now.get(Calendar.MILLISECOND));
}

From source file:Main.java

public static void main(String[] args) {
    Calendar calendar = Calendar.getInstance();

    // 15-04-2012
    calendar.set(Calendar.DAY_OF_MONTH, 15);
    calendar.set(Calendar.YEAR, 2012);
    calendar.set(Calendar.HOUR, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MONTH, 3);
    Date start = calendar.getTime();

    // 15-06-2012
    calendar.set(Calendar.MONTH, 5);
    Date end = calendar.getTime();

    calendar.setTime(start);// w ww. jav a 2s.c om
    Date d = null;
    while ((d = calendar.getTime()).before(end) || d.equals(end)) {
        int day = calendar.get(Calendar.DAY_OF_WEEK);
        if (day != Calendar.SATURDAY && day != Calendar.SUNDAY) {
            System.out.println(d);
        }
        calendar.add(Calendar.DAY_OF_MONTH, 1);
    }
}

From source file:Main.java

public static void main(String[] args) {
    Calendar calNewYork = Calendar.getInstance();

    calNewYork.setTimeZone(TimeZone.getTimeZone("America/New_York"));

    System.out.println("Time in New York: " + calNewYork.get(Calendar.HOUR_OF_DAY) + ":"
            + calNewYork.get(Calendar.MINUTE));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Calendar cal = new GregorianCalendar();

    // Get the components of the time
    int hour12 = cal.get(Calendar.HOUR); // 0..11
    int hour24 = cal.get(Calendar.HOUR_OF_DAY); // 0..23
    int min = cal.get(Calendar.MINUTE); // 0..59
    int sec = cal.get(Calendar.SECOND); // 0..59
    int ms = cal.get(Calendar.MILLISECOND); // 0..999
    int ampm = cal.get(Calendar.AM_PM); // 0=AM, 1=PM
}

From source file:DateAddHour.java

public static void main(String[] args) {
    Calendar calendar = Calendar.getInstance();
    System.out.println("Original = " + calendar.getTime());

    // Subtract 2 hour from the current time
    calendar.add(Calendar.HOUR, -2);

    // Add 30 minutes to the calendar time
    calendar.add(Calendar.MINUTE, 30);

    // Add 300 seconds to the calendar time
    calendar.add(Calendar.SECOND, 300);
    System.out.println("Updated  = " + calendar.getTime());
}

From source file:DateAddHour.java

public static void main(String[] args) {
    Calendar calendar = Calendar.getInstance();
    System.out.println("Original = " + calendar.getTime());

    // Substract 2 hour from the current time
    calendar.add(Calendar.HOUR, -2);

    // Add 30 minutes to the calendar time
    calendar.add(Calendar.MINUTE, 30);

    // Add 300 seconds to the calendar time
    calendar.add(Calendar.SECOND, 300);
    System.out.println("Updated  = " + calendar.getTime());
}