If you’ve ever used the strptime()
function to create a timestamp in DuckDB, you may be aware that it will return an error if it can’t construct the timestamp from the format string/s provided.
While such an error could be useful in some situations, it could also be annoying in others.
Fortunately, DuckDB also provides the try_strptime()
function, which will suppress any error that we might ordinarily get in such cases. This function returns null instead of an error.