Created 01-25-2016 10:33 PM
Created 01-27-2016 09:13 AM
all the comments mentioned here are correct,this is small example emp = load 'data' using PigStorage(',') as (empno,ename ,job,mgr,hiredate ,sal,comm,deptno); each_date = foreach emp generate ToDate(hiredate,'dd-MMM-yyyy') as mydate; subt = foreach each_date generate mydate,SubtractDuration(mydate,'PT1M'); dump subt;
Created 01-25-2016 10:41 PM
Created 01-25-2016 11:58 PM
you need to refer to the standard for ISO 8601 to specify duration or period linked Here. For example PT1M is a one-minute duration. Here's the implementation of the function if you need clear understanding. Get to know jodatime java library and Period object to get a handle on this function. Excellent question!
Created 01-27-2016 09:13 AM
all the comments mentioned here are correct,this is small example emp = load 'data' using PigStorage(',') as (empno,ename ,job,mgr,hiredate ,sal,comm,deptno); each_date = foreach emp generate ToDate(hiredate,'dd-MMM-yyyy') as mydate; subt = foreach each_date generate mydate,SubtractDuration(mydate,'PT1M'); dump subt;
Created 01-27-2016 09:16 AM
use ISO time pattern instead of dd-MMM-yyyy from my code