Java Code Examples for java.util.Calendar.ZONE_OFFSET

The following are Jave code examples for showing how to use ZONE_OFFSET of the java.util.Calendar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: airgram   File: FastDateParser.java   View Source Code Vote up 6 votes
/**
 * Construct a Strategy that parses a Text field
 *
 * @param field            The Calendar field
 * @param definingCalendar The calendar to obtain the short and long values
 * @return a TextStrategy for the field and Locale
 */
private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
    final ConcurrentMap<Locale, Strategy> cache = getCache(field);
    Strategy strategy = cache.get(locale);
    if (strategy == null) {
        strategy = field == Calendar.ZONE_OFFSET
                ? new TimeZoneStrategy(locale)
                : new TextStrategy(field, definingCalendar, locale);
        final Strategy inCache = cache.putIfAbsent(locale, strategy);
        if (inCache != null) {
            return inCache;
        }
    }
    return strategy;
}
 
Example 2
Project: PlusGram   File: FastDateParser.java   View Source Code Vote up 6 votes
/**
 * Construct a Strategy that parses a Text field
 *
 * @param field            The Calendar field
 * @param definingCalendar The calendar to obtain the short and long values
 * @return a TextStrategy for the field and Locale
 */
private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
    final ConcurrentMap<Locale, Strategy> cache = getCache(field);
    Strategy strategy = cache.get(locale);
    if (strategy == null) {
        strategy = field == Calendar.ZONE_OFFSET
                ? new TimeZoneStrategy(locale)
                : new TextStrategy(field, definingCalendar, locale);
        final Strategy inCache = cache.putIfAbsent(locale, strategy);
        if (inCache != null) {
            return inCache;
        }
    }
    return strategy;
}
 
Example 3
Project: uavstack   File: DateTimeHelper.java   View Source Code Vote up 4 votes
/**
 * 指定时间的秒数 指定时间零点的秒数加指定天数的秒数
 * 
 * @param time
 *            时间
 * @param range
 *            天
 * @return
 */
public static long getSpecifyTimeSec(long time, int range) {

    Date date = new Date((time * 1000 + (23 - Calendar.ZONE_OFFSET) * 3600000) / 86400000 * 86400000
            - (23 - Calendar.ZONE_OFFSET) * 3600000);
    long zeroTime = date.getTime() / 1000;
    long specifyTime = range * 24 * 3600;
    return (zeroTime + specifyTime);
}