[Solved-2 Solutions] Get today's date in yyyy-mm-dd format in Pig ?
- It returns the date-time object of the current time.
Is there a way to get today's date in Pig Script in yyyy-mm-dd format ?
- We can define a TODAYS_DATE variable like this:
- and refer to it every time you need by inserting $TODAYS_DATE in the string:
- Make sure to make no typing mistakes. We can also use % declare, but you will lose the flexibility to override the value from the command line or parameter file.
- We can use ToString(CurrentTime(),'yyyy-MM-dd') as date:chararray in your pig script.