Here you can find the source of calendarToGMTMillis(Calendar cal)
Parameter | Description |
---|---|
cal | The calendar object |
public static long calendarToGMTMillis(Calendar cal)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { /**/*ww w . j av a 2 s .c o m*/ * Convert a calendar object to a long in the form of milliseconds since the * epoch of January 1, 1970. The time is converted to GMT if it is not * already in that timezone so that all times will be in a standard * timezone. * * @param cal * The calendar object * @return The time in milliseconds */ public static long calendarToGMTMillis(Calendar cal) { // get Date object representing this Calendar's time value, millisecond // offset from the Epoch, January 1, 1970 00:00:00.000 GMT (Gregorian) Date date = cal.getTime(); // Returns the number of milliseconds since January 1, 1970, 00:00:00 // GMT represented by this Date object. long time = date.getTime(); return time; } }