Created
December 23, 2016 12:20
-
-
Save jccorrea/dede5d5b7ae68532dee6b8472d935da7 to your computer and use it in GitHub Desktop.
hive- weekofyear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--com substr de data | |
select dt_referencia , weekofyear(regexp_replace(substr(dt_referencia,1,10),'/','-') )from gvt.gvt_lis_stg limit 10; | |
-- sem substr | |
select dt_referencia , weekofyear(regexp_replace(dt_referencia,'/','-') )from gvt.gvt_lis_stg limit 10; | |
# dummy | |
create table dual as select 1 as X ; | |
Select '23/12/2016' , weekofyear(regexp_replace('23/12/2016','/','-') )from DUAL ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment