JWT exp Days-Left Converter

Convert a supplied JWT exp NumericDate and reference NumericDate into signed fractional days remaining and expiry status.

Description

A JWT exp claim is a NumericDate measured in seconds since the Unix epoch.

A JWT exp claim is a NumericDate measured in seconds since the Unix epoch. The difference from a supplied reference time can be expressed in fractional days, with equality at expiration already treated as expired.1, 2

Convert a supplied JWT exp NumericDate and reference NumericDate into signed fractional days remaining and expiry status.

When to use JWT exp Days-Left Converter

Use this tool to convert a supplied JWT exp NumericDate and reference NumericDate into signed fractional days remaining and expiry status.

Choose the text, counts, explicit reference time or format parameters requested by this tool. Follow the stated byte, epoch-time and randomness assumptions.

How to use JWT exp Days-Left Converter and understand its results

  1. Choose the text, counts, explicit reference time or format parameters requested by this tool. Follow the stated byte, epoch-time and randomness assumptions.
  2. Enter expiration, now using the field table and calculation rules, then run the tool.
  3. Read daysLeft, expired. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
expirationExpiration NumericDatenumberRequired
nowReference NumericDatenumberRequired

Enter finite expiration and now values in epoch seconds; fractional seconds and negative dates are accepted. The tool subtracts and converts to days, trying a divided-first expression if subtraction overflows. Positive daysLeft means time remains, zero marks the boundary, and negative values mean elapsed expiration. An irrecoverably nonfinite difference is an error.

daysLeft = (expiration − now)/86,400; expired = now ≥ expiration

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
daysLeftFractional days remainingnumber
expiredExpiration reachedboolean
json
{
  "input": {
    "expiration": 259200,
    "now": 86400
  },
  "output": {
    "daysLeft": 2,
    "expired": false
  }
}

Limitations and assumptions

It does not decode a JWT, verify a signature, check issuer/audience or read the clock. There is no clock-skew leeway, and a future exp does not establish token validity. Do not supply epoch milliseconds without conversion.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.

Alternative or Complementary methods

Use TOTP Step Remaining Seconds: Calculate the TOTP moving counter and whole seconds remaining in its current time step from explicit epoch seconds. For a complementary task, use Certificate Validity Days Left: Classify an explicitly supplied certificate validity interval and calculate fractional days until notAfter using epoch milliseconds.

Further background: RFC 7519: JWT NumericDate and expiration claim.

References

  1. JWT exp Days-Left Converter — tool.io

  2. RFC 7519: JWT NumericDate and expiration claim — RFC Editor

Similar or alternative tools

  • TOTP Step Remaining Seconds

    Calculate the TOTP moving counter and whole seconds remaining in its current time step from explicit epoch seconds.

  • Certificate Validity Days Left

    Classify an explicitly supplied certificate validity interval and calculate fractional days until notAfter using epoch milliseconds.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies