How to use DBMaker function TO_DATE (string_expr, date_format_string)?

~ 0 min
2016-03-09 09:34

TO_DATE (string_expr, date_format_string) is used to convert a selected string to DATE format. The selected string can be of any data type, but it must conform to a valid date when converted to date.

The TO_DATE function consists of two parameters: string_expr and date_format_string. string_expr represents the string that is to be matched, while the date_format_string represents the format that the Date type data result set will take.

The TO_DATE UDF function is in DBMaker's installation directory\shared\udf, it's not created by default in the database. If users want to use it, they have to create it manually.

To excute the following command to create this function:

create function to_date.TO_DATE(varchar(20), varchar(20)) RETURNS DATE;

The example to use TO_DATE:

select to_date('2009-Jan-01', 'YYYY-mon-DD');

select to_date('2009-1-01', 'YYYY-MM-DD');

select  to_date('Feb/29-2000','MoM/DD-YYYY');

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags