Str2date

sql

FUNCTION Str2date(IN s CHAR(n)) RETURNS DATE;

Parameters

+
s character string containing a date.month or date.month.year entry notation

Description

The Str2date function converts the date entry from the s string into the Date type value and returns the value. Empty string will be converted into NULL. You may also the similar CAST SQL function.

Function value

This function returns the date, if the date notation is the (only) content of the s string, NULL otherwise.

Examples of strings that can be converted

SET str = '31.12.2003';
SET str = '1.1';

Examples of strings that cannot be converted

SET str = '12-31-2003';
SET str = '31.2.2001';

See