Code example for Time

Methods: formatset

    /** Caching of current user visible current month/day date */ 
    private String mUserMonthDayString;
    /** Caching of the last updated date. */ 
    private Time mCachedDate = new Time();
    /** Temp variable. Used to avoid object instantiation. */ 
    private Time mTempTime = new Time();
    /** Caching of date stamp of mCachedDate. Not user visible. Persisted. */ 
    private String mCachedDateString;
    public DateTracker(DateOrder dateOrder) {
        this.dateOrder = dateOrder;
    /** Read today's date and cache values. */ 
    public void updateDate() { 
        if (!DateUtil.isSameDate(mTempTime, mCachedDate)) {
            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 
Experience pair programming with AI  Get Codota for Java