@Throws(FitsException::class) fun FitsDate(dStr: String?) { if (dStr == null || dStr.isEmpty()) { return } var match: Matcher = FitsDate.NORMAL_REGEX.matcher(dStr) if (match.matches()) { this.year = getInt(match, FitsDate.NEW_FORMAT_YEAR_GROUP) this.month = getInt(match, FitsDate.NEW_FORMAT_MONTH_GROUP) this.mday = getInt(match, FitsDate.NEW_FORMAT_DAY_OF_MONTH_GROUP) this.hour = getInt(match, FitsDate.NEW_FORMAT_HOUR_GROUP) this.minute = getInt(match, FitsDate.NEW_FORMAT_MINUTE_GROUP) this.second = getInt(match, FitsDate.NEW_FORMAT_SECOND_GROUP) this.millisecond = jdk.nashorn.internal.objects.NativeDate.getMilliseconds( match, FitsDate.NEW_FORMAT_MILLISECOND_GROUP ) } else { match = FitsDate.OLD_REGEX.matcher(dStr) if (match.matches()) { this.year = getInt(match, FitsDate.OLD_FORMAT_YEAR_GROUP) + FitsDate.YEAR_OFFSET this.month = getInt(match, FitsDate.OLD_FORMAT_MONTH_GROUP) this.mday = getInt(match, FitsDate.OLD_FORMAT_DAY_OF_MONTH_GROUP) } else { if (dStr.trim { it <= ' ' }.isEmpty()) { return } throw FitsException("Bad FITS date string \"$dStr\"") } } }
Convert a FITS date string to a Java < CODE > Date < /CODE > object .