Validates a Chinese ID card number and returns the date of birth encoded in it.
Syntax
get_idcard_birthday(<idcardno>)Parameters
idcardno: Required. The ID card number. Must be aSTRINGvalue of exactly 15 or 18 digits.
Return value
Returns a DATETIME value representing the date of birth. Returns null if the input is null or if the ID card number fails validation.
Usage notes
Validation runs before extraction. The function checks the province code (first two digits) and the last digit of the ID card number. If either check fails, the function returns null instead of a partial result.
Both 15-digit and 18-digit formats are supported. The function extracts the date of birth from the appropriate digit positions for each format.
Null input returns null. Passing null as the argument returns null.
Related functions
Other functions: Browse all built-in functions in the same category.
If
GET_IDCARD_BIRTHDAYdoes not meet your requirements, you can extend MaxCompute with a user-defined function (UDF).