Docs

Log in to read the version of docs relevant to your site.

Error 'Should be in valid date format' via API

Problem Statement

This article explains why the API returns the error "Term Ends At: Should be in valid date format" and how to resolve it.

Solution

Chargebee APIs require all time-related fields to be passed as UTC timestamps in seconds. If the value is provided in any other format—such as a standard date string or milliseconds—the API returns this error.
Convert your date and time values to Unix timestamp (UTC) in seconds before making the API call.

Steps to fix the issue

  1. Convert the required date and time to a UTC timestamp in seconds using any Unix time converter tool (for example, epoch).
  1. Ensure that the value you pass in the API payload is a numeric timestamp in seconds, not milliseconds.
  2. Retry the API call with the corrected timestamp.

Additional information

  • Do not provide timestamps in milliseconds. The API accepts only seconds.
  • You can use any online Unix time converter to validate your timestamp values.

Was this article helpful?