You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Soheil Pourbafrani <so...@gmail.com> on 2019/01/29 08:42:38 UTC

date format in Flink SQL

Hi,

I want to convert a string in the format of 1996-8-01 to date and create
Table from the dataset of Tuple3<String, Date, Integer> at the end. Since I
want to apply SQL queries on the date field of the table, for
example, "date_column < 1996-8-01", which java format of date is supported
in Flink?

Re: date format in Flink SQL

Posted by Timo Walther <tw...@apache.org>.
Hi Soheil,

the functions for date/time conversion are pretty limited so far. The 
full list of supported functions can be found here [1]. If you need more 
(which is usually the case), it is easy to implement a custom function [2].

We rely on Java's java.sql.Date as a data type. You can use `SELECT DATE 
'2018-09-23'` to create literals.

I hope this helps.

Regards,
Timo

[1] 
https://ci.apache.org/projects/flink/flink-docs-release-1.7/dev/table/functions.html
[2] 
https://ci.apache.org/projects/flink/flink-docs-release-1.7/dev/table/udfs.html#scalar-functions

Am 29.01.19 um 09:42 schrieb Soheil Pourbafrani:
> Hi,
>
> I want to convert a string in the format of 1996-8-01 to date and 
> create Table from the dataset of Tuple3<String, Date, Integer> at the 
> end. Since I want to apply SQL queries on the date field of the table, 
> for example, "date_column < 1996-8-01", which java format of date is 
> supported in Flink?