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

The following are Jave code examples for showing how to use isSet() 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: OpenJSharp   File: DatatypeConverterImpl.java   View Source Code Vote up 6 votes
private static void formatSeconds(Calendar cal, StringBuilder buf) {
    formatTwoDigits(cal.get(Calendar.SECOND), buf);
    if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds
        int n = cal.get(Calendar.MILLISECOND);
        if (n != 0) {
            String ms = Integer.toString(n);
            while (ms.length() < 3) {
                ms = '0' + ms; // left 0 paddings.
            }
            buf.append('.');
            buf.append(ms);
        }
    }
}
 
Example 2
Project: OpenJSharp   File: DatatypeConverterImpl.java   View Source Code Vote up 6 votes
private static void formatSeconds(Calendar cal, StringBuilder buf) {
    formatTwoDigits(cal.get(Calendar.SECOND), buf);
    if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds
        int n = cal.get(Calendar.MILLISECOND);
        if (n != 0) {
            String ms = Integer.toString(n);
            while (ms.length() < 3) {
                ms = '0' + ms; // left 0 paddings.
            }
            buf.append('.');
            buf.append(ms);
        }
    }
}
 
Example 3
Project: openjdk-jdk10   File: DatatypeConverterImpl.java   View Source Code Vote up 6 votes
private static void formatSeconds(Calendar cal, StringBuilder buf) {
    formatTwoDigits(cal.get(Calendar.SECOND), buf);
    if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds
        int n = cal.get(Calendar.MILLISECOND);
        if (n != 0) {
            String ms = Integer.toString(n);
            while (ms.length() < 3) {
                ms = '0' + ms; // left 0 paddings.
            }
            buf.append('.');
            buf.append(ms);
        }
    }
}
 
Example 4
Project: openjdk-jdk10   File: DatatypeConverterImpl.java   View Source Code Vote up 6 votes
private static void formatSeconds(Calendar cal, StringBuilder buf) {
    formatTwoDigits(cal.get(Calendar.SECOND), buf);
    if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds
        int n = cal.get(Calendar.MILLISECOND);
        if (n != 0) {
            String ms = Integer.toString(n);
            while (ms.length() < 3) {
                ms = '0' + ms; // left 0 paddings.
            }
            buf.append('.');
            buf.append(ms);
        }
    }
}
 
Example 5
Project: valifi   File: ValiFieldDate.java   View Source Code Vote up 3 votes
/**
 * Checking for specific type if value is empty.
 * Used for checking if empty is allowed.
 *
 * @param actualValue value when checking
 * @return true when value is empty, false when values is not empty (e.g for String, use isEmpty())
 * @see #mCallback
 */
@Override
protected boolean whenThisFieldIsEmpty(@NonNull Calendar actualValue) {
	return !actualValue.isSet(Calendar.YEAR);    // TODO maybe check other values
}