phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Riesland, Zack" <Zack.Riesl...@sensus.com>
Subject RE: Help with dates
Date Tue, 05 Apr 2016 14:49:22 GMT
Fantastic.

Thanks James

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Tuesday, April 05, 2016 10:10 AM
To: user
Subject: Re: Help with dates

Phoenix let's you cast a BIGINT directly to a DATE, like this:
    CAST(1458132989477 as DATE)
or like this if your BIGINT is in a column value:
    CAST(my_bigint as DATE)

Thanks,
James

On Tue, Apr 5, 2016 at 6:31 AM, Riesland, Zack <Zack.Riesland@sensus.com<mailto:Zack.Riesland@sensus.com>>
wrote:
I have ms-based, GMT timestamps in BigInt columns in one of my phoenix tables.

It’s easy to work with these in Java, but I’m struggling to find the right syntax to easily
read them in a simple query.

For example: '1458132989477'

I know this is Wed, 16 Mar 2016 12:56:29.477 GMT

But when I do something like this:

to_char(to_date('1458132989477', 'S'), 'yyyy-MM-dd')


I get 1970-01-25

I looked at the functions page of the Phoenix website: https://phoenix.apache.org/language/functions.html
Can someone help me figure out what I’m missing? Is there an official list of arguments
for to_date()?

Thanks!

Mime
View raw message