The DateFormat class has the following method:
valid determines whether the specified value is one of the constants defined in this class.