You have several options:
Convert it using Pig functions:
eg:
A = load ... B = foreach A { currTime = CurrentTime(); year = (chararray)GetYear(currTime); month = (chararray)GetMonth(currTime); day = (chararray)GetDay(currTime); generate CONCAT(CONCAT(CONCAT(year, '-'), CONCAT(month, '-')),day) as myDate; }
OR pass the date to the script as a parameter:
pig -f script.pig -param CURR_DATE=`date +%Y-%m-%d`
OR declare it in a script:
%declare CURR_DATE `date +%Y-%m-%d`;
Then refer to the variable as '$CURR_DATE' in the script.
You can also create a modified CurrentTime UDF in which you convert the DateTime object to the appropriate format using the Joda-Time library.
The easiest way would be to declare a date at the beginning of the script.
source share