io.hcxprotocol.utils.DateTimeUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hcx-integrator-sdk Show documentation
Show all versions of hcx-integrator-sdk Show documentation
The SDK for HCX Participant System to help in integrating with HCX Gateway easily.
package io.hcxprotocol.utils;
import lombok.experimental.UtilityClass;
import org.joda.time.DateTime;
/**
* The Date time Util to validate timestamp.
*/
@UtilityClass
public class DateTimeUtils {
public static boolean validTimestamp(String timestamp) {
try {
DateTime requestTime = new DateTime(timestamp);
DateTime currentTime = DateTime.now();
return !requestTime.isAfter(currentTime);
} catch (Exception e) {
return false;
}
}
}