Re: handling Date

2016-02-14 Thread Paolo Spanevello
thanks it works!

2016-02-12 17:53 GMT+01:00 Andries Engelbrecht :

> You can use to_timestamp to get the timestamp and then just cast the date
> and time from the timestamp.
>
> 0: jdbc:drill:> select CAST(to_timestamp('2016/01/16 09:44:28 UTC',
> '/MM/dd HH:mm:ss z') as date) from (values(1));
> +-+
> |   EXPR$0|
> +-+
> | 2016-01-16  |
> +-+
> 1 row selected (0.148 seconds)
> 0: jdbc:drill:> select CAST(to_timestamp('2016/01/16 09:44:28 UTC',
> '/MM/dd HH:mm:ss z') as time) from (values(1));
> +---+
> |  EXPR$0   |
> +---+
> | 09:44:28  |
> +---+
> 1 row selected (0.15 seconds)
>
> --Andries
>
> > On Feb 12, 2016, at 7:15 AM, Paolo Spanevello 
> wrote:
> >
> > Dear All,
> >
> > I have a field with a date like this:
> >
> >
> > Date
> >
> > 2016/01/16 09:44:28 UTC
> > I would like to split it in Date, Time and remove "UTC".
> >
> > Somebody can support me?
> >
> > Best,
> > Paolo
>
>


handling Date

2016-02-12 Thread Paolo Spanevello
Dear All,

I have a field with a date like this:


Date

2016/01/16 09:44:28 UTC
I would like to split it in Date, Time and remove "UTC".

Somebody can support me?

Best,
Paolo


Re: handling Date

2016-02-12 Thread Andries Engelbrecht
You can use to_timestamp to get the timestamp and then just cast the date and 
time from the timestamp.

0: jdbc:drill:> select CAST(to_timestamp('2016/01/16 09:44:28 UTC', '/MM/dd 
HH:mm:ss z') as date) from (values(1));
+-+
|   EXPR$0|
+-+
| 2016-01-16  |
+-+
1 row selected (0.148 seconds)
0: jdbc:drill:> select CAST(to_timestamp('2016/01/16 09:44:28 UTC', '/MM/dd 
HH:mm:ss z') as time) from (values(1));
+---+
|  EXPR$0   |
+---+
| 09:44:28  |
+---+
1 row selected (0.15 seconds)

--Andries

> On Feb 12, 2016, at 7:15 AM, Paolo Spanevello  wrote:
> 
> Dear All,
> 
> I have a field with a date like this:
> 
> 
> Date
> 
> 2016/01/16 09:44:28 UTC
> I would like to split it in Date, Time and remove "UTC".
> 
> Somebody can support me?
> 
> Best,
> Paolo