Get today date in yyyy-mm-dd format in Pig

Is there a way I can get today's date in Pig Script in yyyy-mm-dd format. I can not get any API for this.

thank

+4
source share
2 answers

You can define a variable TODAYS_DATEas follows:

%default TODAYS_DATE `date +%Y-%m-%d`;

and refer to it every time you need by pasting $TODAYS_DATEin a line:

'/data/mydata/$TODAYS_DATE'

Be sure not to print errors. You can also use %declare, but you will lose the flexibility to override a value from the command line or parameter file.

+4
source

You can use ToString(CurrentTime(),'yyyy-MM-dd') as date:chararraya script in the swing .

+2
source

Source: https://habr.com/ru/post/1541025/


All Articles