Code example for TimeZone

Methods: setDefault

0
    /** 
     * Format and return the given {@link Blocks} values using 
     * {@link #CONFERENCE_TIME_ZONE}. 
     */ 
    public static String formatBlockTimeString(long blockStart, long blockEnd, Context context) {
        TimeZone.setDefault(CONFERENCE_TIME_ZONE);
 
        // NOTE: There is an efficient version of formatDateRange in Eclair and 
        // beyond that allows you to recycle a StringBuilder. 
        return DateUtils.formatDateRange(context, blockStart, blockEnd, TIME_FLAGS);
    } 
 
    public static boolean isSameDay(long time1, long time2) {
        TimeZone.setDefault(CONFERENCE_TIME_ZONE);
 
        Calendar cal1 = Calendar.getInstance();
        Calendar cal2 = Calendar.getInstance();
        cal1.setTimeInMillis(time1);
        cal2.setTimeInMillis(time2);
        return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) &&
                cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR);