Code example for Time

Methods: format, set

0
    } 
 
    /** Read today's date and cache values. */ 
    public void updateDate() { 
        mTempTime.setToNow();
        if (!DateUtil.isSameDate(mTempTime, mCachedDate)) {
            mCachedDate.set(mTempTime);
            mCachedDateString = DateUtil.dateToString(mCachedDate);
            mUserDayOfWeekString = mCachedDate.format("%A");
            // NOTE: this value is cached for performance. If underlying system date order is changed,  
            // it will be reflected in next app restart. 
            mUserMonthDayString = mCachedDate
                    .format(dateOrder.monthBeforeDay() ? "%b %d" : "%d %b");
        } 
    } 
 
    /** 
     * Return an unspecified time that is guaranteed to be today. Can change. Caller should not 
     * change. 
     */ 
    public final Time sometimeToday() {