drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Blue <jb...@maprtech.com>
Subject Re: coaxing hour of day from a timestamp
Date Tue, 02 Aug 2016 21:11:59 GMT
*Query:*
select
Datatime_start,
date_part('day',Datatime_Start) `day`,
date_part('month',Datatime_Start) `month`,
date_part('year',Datatime_Start) `year`,
date_part('hour',Datatime_Start) `hour`,
date_part('minute',Datatime_Start) `minute`
from dfs.tmp.tv
limit 1

The question is = how do I get hour = 2?

*Output:*
Datatime_start  day month year hour minute second
28/04/16 2:00   16  4     2028 0    0      0

On Tue, Aug 2, 2016 at 2:08 PM, Andries Engelbrecht <
aengelbrecht@maprtech.com> wrote:

> Attachments do not show on the mail list, perhaps just type out an example.
>
> --Andries
>
> > On Aug 2, 2016, at 1:56 PM, Joseph Blue <jblue@maprtech.com> wrote:
> >
> > My bad on the formatting. Here is a screen shot of the query. Note bad
> m/d/y and hour=min=sec=0.0
> >
> >
> > On Tue, Aug 2, 2016 at 1:46 PM, Joseph Blue <jblue@maprtech.com <mailto:
> jblue@maprtech.com>> wrote:
> > The field I have is a timestamp. The date is obviously in wrong order in
> the time stamp (I can break it up and reassemble to get a good date, so no
> problem there).
> > I do not seem to be able to get the hour of the day using the
> date_parts, so that data seems obscured.
> > Any ideas how to get the 2 o'clock time out of this field?
> >
> > Query...
> > select
> > Datatime_start,
> > date_part('day',Datatime_Start) `day`,
> > date_part('month',Datatime_Start) `month`,
> > date_part('year',Datatime_Start) `year`,
> > date_part('hour',Datatime_Start) `hour`,
> > date_part('minute',Datatime_Start) `minute`
> > from dfs.tmp.tv <http://dfs.tmp.tv/>
> > limit 5
> >
> > Results....
> >
> > Datatime_start
> > day
> > month
> > year
> > hour
> > minute
> > Datatime_start
> > day
> > month
> > year
> > hour
> > minute
> > 28/04/16 2:00 16 4 2028 0 0 28/04/16 2:00 16 4 2028 0 0 28/04/16 2:00 16
> 4 2028 0 0 28/04/16 2:00 16 4 2028 0 0
> >
> >
> >
> >
> >
> >
> > --
> > Joseph Blue
> > Data Scientist
> > jblue@maprtech.com <mailto:jblue@maprtech.com> | www.mapr.com <
> http://www.mapr.com/>
> > Mobile: 858-357-4926 <tel:858-357-4926>
> >
> >
> >
> >
> >
> >
> > --
> > Joseph Blue
> > Data Scientist
> > jblue@maprtech.com <mailto:jblue@maprtech.com> | www.mapr.com <
> http://www.mapr.com/>
> > Mobile: 858-357-4926
> >
>
>


-- 
Joseph Blue
Data Scientist
jblue@maprtech.com | www.mapr.com
*Mobile: 858-357-4926*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message