[ https://issues.apache.org/jira/browse/PIG-1151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
sam rash updated PIG-1151: -------------------------- Priority: Minor (was: Major) > Data Conversion + Arithmetic UDFs > --------------------------------- > > Key: PIG-1151 > URL: https://issues.apache.org/jira/browse/PIG-1151 > Project: Pig > Issue Type: New Feature > Affects Versions: 0.5.0 > Reporter: sam rash > Priority: Minor > > I would like to offer up some very simple data UDFs I have that wrap JodaTime > (apache 2.0 license, http://joda-time.sourceforge.net/license.html) and > operate on ISO8601 date strings. > (for piggybank). Please advise if these are appropriate. > 1. Date Arithmetic > takes an input string: > 2009-01-01T13:43:33.000Z > (and partial ones such as 2009-01-02) > and a timespan (as millis or as string shorthand) > returns an ISO8601 string that adjusts the input date by the specified > timespan > DatePlus(long timeMs); // + or - number works, is the # of millis > DatePlus(String timespan); //10m = 10 minutes, 1h = 1 hour, 1172 ms, etc > DateMinus(String timespan); //propose explicit minus when using string > shorthand for time periods > 2. Date Comparison (when you don't have full strings that you can use string > compare with): > DateIsBefore(String dateString); //true if lhs is before rhs > DateIsAfter(String dateString); //true if lsh is after rhs > 3. date trunc functions: > takes partial ISO8601 strings and truncates to: > toMinute(String dateString); > toHour(String dateString); > toDay(String dateString); > toWeek(String dateString); > toMonth(String dateString); > toYear(String dateString); > if any/all are helpful, I'm happy to contribute to pig -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.