|
|
-
Converting Timestamp to Date omly
Raihan Jamal 2012-07-18, 20:11
This is the Timestamp *1338674299000*
When I tried converting the above timestamp into the date only.
I got this below result for date by using this syntax- *to_date(from_unixtime(cast(prod_and_ts.timestamps as BIGINT)))*
*44390-11-25*
* *
* *
Anything wrong I am doing in my syntax? *Raihan Jamal*
-
Re: Converting Timestamp to Date omly
Paul Mackles 2012-07-18, 20:14
That timestamp is in millseconds but the hive date functions expect seconds. Try dividing by 1000 first.
From: Raihan Jamal <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> Subject: Converting Timestamp to Date omly
This is the Timestamp 1338674299000
When I tried converting the above timestamp into the date only. I got this below result for date by using this syntax- to_date(from_unixtime(cast(prod_and_ts.timestamps as BIGINT)))
44390-11-25 Anything wrong I am doing in my syntax? Raihan Jamal
-
Re: Converting Timestamp to Date omly
Raihan Jamal 2012-07-18, 20:16
Can you show me exact syntax, how to do this? It will be of great help to me. Thanks. *Raihan Jamal*
On Wed, Jul 18, 2012 at 1:14 PM, Paul Mackles <[EMAIL PROTECTED]> wrote:
> That timestamp is in millseconds but the hive date functions expect > seconds. Try dividing by 1000 first. > > From: Raihan Jamal <[EMAIL PROTECTED]> > Reply-To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > Subject: Converting Timestamp to Date omly > > This is the Timestamp *1338674299000* > > > > When I tried converting the above timestamp into the date only. > > I got this below result for date by using this syntax- *to_date(from_unixtime(cast(prod_and_ts.timestamps > as BIGINT)))* > > > > *44390-11-25* > > * > * > > * > * > > Anything wrong I am doing in my syntax? > > > *Raihan Jamal* > >
-
Re: Converting Timestamp to Date omly
Raihan Jamal 2012-07-18, 20:21
*to_date(from_unixtime(cast(prod_and_ts.timestamps /1000 as BIGINT)))* * * So this should work? I am currently running to see the output.
*Raihan Jamal*
On Wed, Jul 18, 2012 at 1:16 PM, Raihan Jamal <[EMAIL PROTECTED]> wrote:
> Can you show me exact syntax, how to do this? It will be of great help to > me. Thanks. > > > > > *Raihan Jamal* > > > > On Wed, Jul 18, 2012 at 1:14 PM, Paul Mackles <[EMAIL PROTECTED]> wrote: > >> That timestamp is in millseconds but the hive date functions expect >> seconds. Try dividing by 1000 first. >> >> From: Raihan Jamal <[EMAIL PROTECTED]> >> Reply-To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> Subject: Converting Timestamp to Date omly >> >> This is the Timestamp *1338674299000* >> >> >> >> When I tried converting the above timestamp into the date only. >> >> I got this below result for date by using this syntax- *to_date(from_unixtime(cast(prod_and_ts.timestamps >> as BIGINT)))* >> >> >> >> *44390-11-25* >> >> * >> * >> >> * >> * >> >> Anything wrong I am doing in my syntax? >> >> >> *Raihan Jamal* >> >> >
|
|
All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by
Sematext