Hi Is there any way to check whether the given string is epoch millis or not
The below code from java.time package converts to EpochMillis.
I am looking for isEpochMillis to return a boolean condition.
Is there any ready made api from apache commons or google guava to check this ? just like isDouble isLong etc...
/**
* Obtains an instance of {@code Instant} using milliseconds from the
* epoch of 1970-01-01T00:00:00Z.
* <p>
* The seconds and nanoseconds are extracted from the specified milliseconds.
*
* @param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z
* @return an instant, not null
* @throws DateTimeException if the instant exceeds the maximum or minimum instant
*/
public static Instant ofEpochMilli(long epochMilli) {
long secs = Math.floorDiv(epochMilli, 1000);
int mos = (int)Math.floorMod(epochMilli, 1000);
return create(secs, mos * 1000_000);
}