DtSearchValidDateString(library call)

NAME
DtSearchValidDateString — Validate and convert a user date string

SYNOPSIS

#include <Dt/Search.h>
DtSrObjdate DtSearchValidDateString(
char *date_string);

DESCRIPTION

DtSearchValidDateString validates a DtSearch date string, as might have been entered by a user in a free form text field, and converts it into a valid DtSrObjdate.

Since an invalid date string format returns a distinctive DtSrObjdate, this function may also be used as a boolean test for string validity.

ARGUMENTS

date_string
    Specifies the date string to be validated and converted.

    The format for a valid date string is "[yyyy [mm [dd]]", one, two, or three ASCII numeric tokens separated by one or more nonnumeric chars (whitespace, slashes, etc). The integer yyyy represents a Gregorian calendar year number in the range 1990 to 5995 inclusive. If yyyy is less than 1900, 1900 is added to it. The integer mm is a Gregorian calendar month number in the range 1 to 12 inclusive. The integer dd is a Gregorian calendar day number in the range 1 to 31 inclusive.

    If only two tokens are in the string, they are presumed to be yyyy and mm, and dd is presumed to be to 1.

    If only one token is in the string, it is presumed to be yyyy, and both mm and dd are presumed to be 1.

RETURN VALUE

DtSearchValidDateString returns zero (a valid DtSrObjdate) if date_string is NULL or empty.

It returns a correctly formatted DtSrObjdate on successful parse and conversion.

It returns -1 and a message on the MessageList if date_string is invalid.

SEE ALSO

DtSrAPI(3), DtSearchQuery(3), dtsrfzkfiles(4), DtSearch(5)