Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

-180

Datetime value is invalidNEGATIVE SQLCODE · CHECKED 2026-11-14
Checked against IBM documentation

The length or string form of a DATE, TIME or TIMESTAMP value does not match any valid format.

QUICK ANSWER

The length or string form of a DATE, TIME or TIMESTAMP value does not match any valid format.

LIKELY CAUSES, IN THE ORDER OF THIS ENTRY

  1. A host variable holds a date, time or timestamp string of the wrong length or layout.
  2. A character string constant is not a valid datetime string.
  3. A character column being converted holds a value that is not a valid datetime string.

CHECKED 14 Nov 2026 IBM: Db2 13 for z/OS: SQLCODE -180 (Db2 for z/OS 13.0.0)

MOST LIKELY

A host variable holds a date, time or timestamp string of the wrong length or layout.

FIRST CHECK

Use the token in the message to find the host variable, constant or column.

TRY IT ▸

Site search

What it means

The value does not conform to any valid DATE, TIME or TIMESTAMP format. The message identifies the host variable position, string constant or column involved. SQLSTATE is 22007.

A related error, -181, covers a string that has a valid shape but is out of range.

Typical causes

  • A host variable holds a date, time or timestamp string of the wrong length or layout.
  • A character string constant is not a valid datetime string.
  • A character column being converted holds a value that is not a valid datetime string.

How to fix it

  1. Use the token in the message to find the host variable, constant or column.
  2. Correct the program so the value follows DATE, TIME or TIMESTAMP syntax.
  3. Review the datetime formats in the Db2 documentation.