public Object formatSasDateTime()

in src/main/java/com/epam/parso/date/SasTemporalFormatter.java [147:177]


    public Object formatSasDateTime(Double sasSeconds, OutputDateType dateFormatType,
                                    String sasFormatName, int width, int precision) {
        if (dateFormatType == SAS_VALUE) {
            return sasSeconds;
        } else if (sasSeconds == null || Double.isNaN(sasSeconds)) {
            if (dateFormatType == SAS_FORMAT_EXPERIMENTAL || dateFormatType == SAS_FORMAT_TRIM_EXPERIMENTAL) {
                return ".";
            } else {
                return null;
            }
        }

        sasSeconds = sasLeapSecondsFix(sasSeconds);

        switch (dateFormatType) {
            case EPOCH_SECONDS:
                return sasSecondsToEpochSeconds(sasSeconds);
            case JAVA_TEMPORAL:
                return sasSecondsToLocalDateTime(sasSeconds, 9);
            case SAS_FORMAT_EXPERIMENTAL:
            case SAS_FORMAT_TRIM_EXPERIMENTAL:
                boolean trim = dateFormatType == SAS_FORMAT_TRIM_EXPERIMENTAL;
                return dateTimeFormatFunctions.computeIfAbsent(sasFormatName + width + "." + precision,
                        k -> SasDateTimeFormat.valueOf(sasFormatName)
                                .getFormatFunction(width, precision, trim)
                ).apply(sasSeconds);
            case JAVA_DATE_LEGACY:
            default:
                return sasSecondsToDate(sasSeconds);
        }
    }