Java Code Examples for java.util.Calendar.toString()

The following are Jave code examples for showing how to use toString() 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.
Example 1
Project: ChronoBike   File: CalendarCacheManager.java   Source Code and License Vote up 7 votes
void setCurrentOpenState(CalendarOpenState state, OpenCalendarRange range)
{
	long lCurrentTime_ms = m_currentDate.getTimeInMillis();
	String cs0 = m_currentDate.toString();
	
	m_currentState = state;
	m_currentOpenCalendarRange = range;

	Calendar calEnd = Calendar.getInstance();
	calEnd.set(m_currentDate.getYear(), m_currentDate.getMonth(), m_currentDate.getDay(), range.m_nHour[1], range.m_nMinute[1], range.m_nSecond[1]); 

	m_timeNextCheck_ms = calEnd.getTimeInMillis();
	String cs = calEnd.toString();
	
	long l = (m_timeNextCheck_ms - lCurrentTime_ms);
	l /= 1000 ;
	int n = 0;		
}
 
Example 2
Project: openjdk-jdk10   File: BuddhistCalendarTest.java   Source Code and License Vote up 6 votes
/**
 * 4847186: BuddhistCalendar: toString() returns Gregorian year
 */
static void testToString() {
    Calendar cal = getBuddhistCalendar();
    int year = cal.get(YEAR);
    String s = cal.toString();
    String y = s.replaceAll(".+,YEAR=(\\d+),.+", "$1");
    if (Integer.parseInt(y) != year) {
        throw new RuntimeException("toString(): wrong year value: got " + y
                                   + ", expected " + year);
    }
}