May 26, 2021 Apache Pig
Apache Pig provides the following date and time functions -
S.N. | Functions and descriptions |
---|---|
1 |
ToDate(milliseconds)
This function returns a date-time object based on a given argument. Another alternative to this function is ToDate (iosstring), ToDate (userstring, format), and ToDate (userstring, format, timezone). |
2 |
CurrentTime()
Returns the date time object for the current time. |
3 |
GetDay(datetime)
Returns a day of the month from the date time object. |
4 |
GetHour(datetime)
Returns hours of the day from the date-time object. |
5 |
GetMilliSecond(datetime)
Returns milliseconds in seconds from the date-time object. |
6 |
GetMinute(datetime)
Returns minutes in one hour from the date-time object. |
7 |
GetMonth(datetime)
Returns the month of the year from the date-time object. |
8 |
GetSecond(datetime)
Returns a minute's second from the date-time object. |
9 |
GetWeek(datetime)
Returns the week of the year from the date-time object. |
10 |
GetWeekYear(datetime)
Returns the anniversary from the date-time object. |
11 |
GetYear(datetime)
The year is returned from the date-time object. |
12 |
AddDuration(datetime, duration)
Returns the result of the date-time object and the duration object. |
13 |
SubtractDuration(datetime, duration)
Subtract the Duration object from the Date-Time object and return the result. |
14 |
DaysBetween(datetime1, datetime2)
Returns the number of days between the two date-time objects. |
15 |
HoursBetween(datetime1, datetime2)
Returns the number of hours between two date-time objects. |
16 |
MilliSecondsBetween(datetime1, datetime2)
Returns the number of milliseconds between the two date-time objects. |
17 |
MinutesBetween(datetime1, datetime2)
Returns the number of minutes between two date-time objects. |
18 |
MonthsBetween(datetime1, datetime2)
Returns the number of months between the two date time objects. |
19 |
SecondsBetween(datetime1, datetime2)
Returns the number of seconds between two date-time objects. |
20 |
WeeksBetween(datetime1, datetime2)
Returns the number of weeks between the two date-time objects. |
21 |
YearsBetween(datetime1, datetime2)
Returns the number of years between the two date time objects. |