The current PETSc version and the API for accessing it are defined in petscversion.h
The complete version number is given as the triple PETSC_VERSION_MAJOR.PETSC_VERSION_MINOR.PETSC_VERSION_SUBMINOR (in short hand x.y.z)
A change in the minor version number (y) indicates possible/likely changes in the PETSc API. Note this is different than with the semantic versioning convention where only a change in the major version number (x) indicates a change in the API.
A subminor greater than zero indicates a patch release. Version x.y.z maintains source and binary compatibility with version x.y.w for all z and w
Use the macros PETSC_VERSION_EQ(x,y,z), PETSC_VERSION_LT(x,y,z), PETSC_VERSION_LE(x,y,z), PETSC_VERSION_GT(x,y,z), PETSC_VERSION_GE(x,y,z) to determine if the current version is equal to, less than, less than or equal to, greater than or greater than or equal to a given version number (x.y.z).
PETSC_RELEASE_DATE is the date the x.y version was released (i.e. the version before any patch releases)
PETSC_VERSION_DATE is the date the x.y.z version was released
PETSC_VERSION_GIT is the last git commit to the repository given in the form vx.y.z-wwwww
PETSC_VERSION_DATE_GIT is the date of the last git commit to the repository
PETSC_VERSION_() and PETSC_VERSION_PATCH are deprecated and will eventually be removed. For several releases PETSC_VERSION_PATCH is always 0