Get today's date in yyyy-mm-dd format in Pig
apache-pig
Solution
You can define a `TODAYS_DATE` variable like this:
%default TODAYS_DATE `date +%Y-%m-%d`;
and refer to it every time you need by inserting `$TODAYS_DATE` in the string:
'/data/mydata/$TODAYS_DATE'
Make sure to make no typing mistakes. You may also use `%declare`, but you will lose the flexibility to override the value from the command line or parameter file.
Problem
Is there a way where I can get today's date in Pig Script in yyyy-mm-dd format. I am unable to get hold of any API for that. Thanks