Title | Transformes funciones explicacion Datastage Guia |
---|---|
Course | Base de Datos |
Institution | Universidad de Buenos Aires |
Pages | 47 |
File Size | 426.2 KB |
File Type | |
Total Downloads | 108 |
Total Views | 139 |
Explicacion funciones de transformer datastage hola hola hola hola hola hola hola hola hola hola hola nyaaaaa...
Dateandtimefunctions Youcanusethedateandtimefunctionstoperformvariousoperationsondatesandtimes intheTransformerstage. Functionsthatspecifydates,times,ortimestampsintheargumentsusestringswith specificformats: ●
Foradate,theformatis%yyyy %mm %dd
●
Foratime,theformatis%hh : %nn: %ss. Ifextendedtoincludemicroseconds,theformat is%hh: %nn: %ss.x wherex givesthenumberofdecimalplacessecondsisgivento.
●
Foratimestamp,theformatis%yyyy %mm %dd %hh: %nn : %ss. Ifextendedtoinclude microseconds,theformatis%yyyy %mm %dd %hh: %nn : %ss.x, wherex givesthe numberofdecimalplacessecondsisgivento. Functionsthathavedaysofweekintheargumenttakeastringspecifyingthedayofthe week.Thedayisspecifiedasathreeletterabbreviation,orthefullname.Forexample, thestrings"thu"and"thursday"arebothvalid. ThefollowingfunctionsareintheDate&Timecategoryoftheexpressioneditor.Square bracketsindicateanargumentisoptional.Theexamplesshowthefunctionasitappears inaDerivationfieldintheTransformerstage. CurrentDate Returnsthedatethatthejobrunsindateformat. ●
Input:
●
Output:date
●
Examples.Usethisfunctiontoaddanewcolumncontainingthedateto thedataoutputbytheTransformerstage: CurrentDate()
●
CurrentTime Returnsthetimeatwhichthejobrunsintimeformat. ●
Input:
●
Output:time
Examples.Usethisfunctiontoaddanewcolumncontainingthetimeto thedataoutputbytheTransformerstage: ● CurrentTime() CurrentTimeMS Returnsthetimeatwhichthejobrunsintimeformat,thetimeincludes microseconds. ●
●
Input:
●
Output:time
Examples.Usethisfunctiontoaddanewcolumncontainingthetimeto thedataoutputbytheTransformerstage.YoumustsettheExtendedfield inthecolumnmetadatatoMicrosecondstocontainthefulltime: ● CurrentTimeMS() CurrentTimestamp Returnsatimestampgivingthedateandtimethatthejobrunsintimestamp format. ● Input: ●
●
Output:timestamp
●
Examples.Usethisfunctiontoaddanewcolumncontainingthe timestamptothedataoutputbytheTransformerstage:
● CurrentTimestamp() CurrentTimestampMS Returnsatimestampgivingthedateandtimethatthejobrunsintimestamp format,thetimepartincludesmicroseconds. ●
Input:
●
Output:timestamp
Examples.Usethisfunctiontoaddanewcolumncontainingthe timestamptothedataoutputbytheTransformerstage.Youmustsetthe ExtendedfieldinthecolumnmetadatatoMicrosecondstocontainthefull timestamp. ● CurrentTimestampMS() DateFromDaysSince Returnsadatebyaddinganintegertoabaselinedate.Theintegercanbenegative toreturnadatethatisearlierthanthebasedate. ● Input:number(int32),[baseline_date(date)] ●
●
Output:date
Examples.Ifmylink.myintcolcontainstheinteger18250,and mylink.mydatecolcontainsthedate1958–08–18,thenthethreefollowing functionsareequivalent,andreturnthedate2008–08–05: ● DateFromDaysSince(18250,"19580818") ● DateFromDaysSince(mylink.myintcol,"19580818") DateFromDaysSince(mylink.myintcol,mylink.mydatecol) Ifmylink.mynegintcolcontainstheinteger1,andmylink.mydatecol containsthedate1958–08–18,thenthefollowingthreefunctionsare equivalent,andreturnthedate1958–08–17: DateFromDaysSince(1,"19580818") DateFromDaysSince(mylink.mynegintcol,"19580818") DateFromDaysSince(mylink.mynegintcol,mylink.mydatecol) DateFromComponents ●
Returnsadatefromthegivenyears,months,anddayofmonthgivenasthree separatevalues. ●
Input:years(int32),months(int32),dayofmonth(int32)
●
Output:date
●
Examples.Ifmylink.yearcolcontainsthevalue2010,mylink.monthcol containsthevalue12,andmylink.dayofmonthcolcontainsthevalue2, thenthetwofollowingfunctionsareequivalent,andreturnthedate 2010–12–02. DateFromComponents(2010,12,2)
●
DateFromComponents(mylink.yearcol,mylink.monthcol, mylink.dayofmonthcol)
DateFromJulianDay Returnsadatefromthegivenjulianday. ●
Input:julianday(uint32)
●
Output:date
Examples.Ifmylink.myjulcolcontainsthevalue2454614,thenthetwo followingfunctionsareequivalent,andreturnthedate2008–05–27. ● DateFromJulianDay(2454614) DateFromJulianDay(mylink.myjulcol) DateOffsetByComponents Returnsthegivendate,withoffsetsappliedfromthegivenyearoffset,month offset,anddayofmonthoffsetgivenasthreeseparatevalues.Theoffsetvalues caneachbepositive,zero,ornegative. ●
●
Input:basedate(date),year_offset(int32),month_offset(int32), dayofmonth_offset(int32)
●
Output:date
●
Examples.Ifmylink.basedatecontains20110818andmylink.yearos containsthevalue2,mylink.monthoscontainsthevalue0,and mylink.dayofmonthosolcontainsthevalue0,thenthetwofollowing functionsareequivalent,andreturnthedate2013–08–18. DateOffsetByComponents("20110818",2011,8,18)
● ●
●
● ●
DateOffsetByComponents(mylink.basedate,mylink.yearos, mylink.monthos, mylink.dayofmonthos)
Ifmylink.basedatecontains20110818andmylink.yearoscontainsthe value2,mylink.monthoscontainsthevalue0,and mylink.dayofmonthosolcontainsthevalue0,thenthetwofollowing functionsareequivalent,andreturnthedate2009–08–18. DateOffsetByComponents("20110818",2011,8,18) DateOffsetByComponents(mylink.basedate,mylink.yearos, mylink.monthos, mylink.dayofmonthos)
DaysSinceFromDate Returnsthenumberofdaysfromsourcedatetothegivendate. ●
Input:source_date,given_date
●
Output:days_since(int32)
●
Examples.Ifmylink.mysourcedatecontainsthedate1958–08–18and mylink.mygivendatecontainsthedate2008–08–18,thenthetwo followingfunctionsareequivalent,andreturntheintegervalue18263. DaysSinceFromDate(mylink.mysourcedate,mylink.mygivendate) DaysSinceFromDate("19580818","20080818")
●
DaysInMonth Returnsthenumberofdaysinthemonthinthegivenbasedate. ●
Input:basedate(date)
●
Output:daysinmonth(int32)
●
Examples.Ifmylink.mysourcedatecontainsthedate1958–08–18,then thetwofollowingfunctionsareequivalent,andreturntheintegervalue31. DaysInMonth(mylink.mysourcedate) DaysInMonth("19580818")
●
DaysInYear Returnsthenumberofdaysintheyearinthegivenbasedate. ●
Input:basedate(date)
●
Output:daysinyearh(int32)
Examples.Ifmylink.mysourcedatecontainsthedate2012–08–18,then thetwofollowingfunctionsareequivalent,andreturntheintegervalue 366. ● DaysInYear(mylink.mysourcedate) DaysInYear("20120818") Ifmylink.mysourcedatecontainsthedate2011–08–18,thenthetwo followingfunctionsareequivalent,andreturntheintegervalue365. DaysInYear(mylink.mysourcedate) DaysInYear("20110818") DateOffsetByDays Returnsthegivendate,offsetbythegivennumberofdays.Theoffsetvaluecan bepositive,zero,ornegative. ●
●
Input:basedate(date),dayoffset(int32)
●
Output:date
●
Examples.Ifmylink.basedatecontains20110818andmylink.dayoffset containsthevalue2,thenthetwofollowingfunctionsareequivalent,and returnthedate2011–08–20. DateOffsetByDays("20110818",2) DateOffsetByDays(mylink.basedate,mylink.dayoffset)
●
Ifmylink.basedatecontains20110818andmylink.dayoffsetcontainsthe value31,thenthetwofollowingfunctionsareequivalent,andreturnthe date2011–07–18. ● DateOffsetByDays("20110818",31) DateOffsetByDays(mylink.basedate,mylink.dayoffset) HoursFromTime Returnsthehourportionofatime. ●
●
Input:time
●
Output:hours(int8)
Examples.Ifmylink.mytimecontainsthetime22:30:00,thenthe followingtwofunctionsareequivalent,andreturntheintegervalue22. ● HoursFromTime(mylink.mytime) HoursFromTime("22:30:00") JulianDayFromDate Returnsajuliandayfromthegivendate. ● Input:date ●
●
Output:julianday(int32)
Examples.Ifmylink.mydatecontainsthedate2008–05–27,thenthetwo followingfunctionsareequivalent,andreturnthevalue2454614. ● JulianDayFromDate("2008–05–27") JulianDayFromDate(mylink.mydate) MicroSecondsFromTime Returnsthemicrosecondportionofatime. ●
●
Input:time
●
Output:microseconds(int32)
Examples.Ifmylink.mytimecontainsthetime22:30:00.32,thenthe followingfunctionreturnsthevalue320000: MicroSecondsFromTime(mylink.mytime) MidnightSecondsFromTime Returnsthenumberofsecondsfrommidnighttothegiventime. ●
●
Input:time
●
Output:seconds(int8)
Examples.Ifmylink.mytimecontainsthetime00:30:52,thenthetwo followingfunctionsareequivalent,andreturnthevalue1852: ● MidnightSecondsFromTime("00:30:52") MidnightSecondsFromTime(mylink.mytime) MinutesFromTime Returnstheminuteportionofatime. ●
●
Input:time
●
Output:minutes(int8)
●
Examples.Ifmylink.mytimecontainsthetime22:30:52,thenthetwo followingfunctionsareequivalent,andreturnthevalue30:
●
MinutesFromTime("22:30:52") MinutesFromTime(mylink.mytime)
MonthDayFromDate Returnsthedayofthemonthfromthegivendate. ●
Input:date
●
Output:day(int8)
Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo followingfunctionsareequivalent,andreturnthevalue18: ● MonthDayFromDate("20080818") MonthDayFromDate(mylink.mydate) MonthFromDate Returnsthemonthnumberfromthegivendate. ●
●
Input:date
●
Output:month_number(int8)
Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo followingfunctionsareequivalent,andreturnthevalue8: ● MonthFromDate("20080818") MonthDayDate(mylink.mydate) NextWeekdayFromDate Returnsthedateofthespecifieddayoftheweeksoonestafterthesourcedate. Thedayoftheweekisspecifiedasthefullname,forexample,thursday,ora threeletterabbreviation,forexample,thu. ● Input:sourcedate(date),day_of_week(string) ●
●
Output:date
●
Examples.Ifmylink.mysourcedatecontainsthedate20080818,thenthe twofollowingfunctionsareequivalent,andreturnthevalue2008–08–21:
●
NextWeekdayFromDate("20080818","thursday") NextWeekdayFromDate(mylink.mysourcedate,"thu")
NthWeekdayFromDate Returnsthedateofthespecifieddayoftheweekoffsetbythespecifiednumber ofweeksfromthesourcedate.Thedayoftheweekisspecifiedasthefullname, forexample,thursday,orathreeletterabbreviation,forexample,thu.Theoffset canbepositive,negative,orzero. ●
Input:basedate(date),day_of_week(string),week_offset(int32)
●
Output:date
●
Examples.Ifmylink.mydatecontainsthedate20090818,thenthetwo followingfunctionsareequivalent,andreturnthevalue2009–08–27:
●
NthWeekdayFromDate("20090818","thursday",1) NthWeekdayFromDate(mylink.mydate,"thu",1)
Ifmylink.mydatecontainsthedate20090818,thenthetwofollowing functionsareequivalent,andreturnthevalue2009–08–06: NthWeekdayFromDate("20090818","thursday",2) NthWeekdayFromDate(mylink.mydate,"thu",2) PreviousWeekdayFromDate Returnsthedateofthespecifieddayoftheweekmostrecentbeforethesource date.Thedayoftheweekisspecifiedasthefullname,forexample,thursday,ora threeletterabbreviation,forexample,thu. ●
Input:sourcedate,day_of_week(string)
●
Output:date
Examples.Ifmylink.mysourcedatecontainsthedate20080818,thenthe twofollowingfunctionsareequivalent,andreturnthevalue2008–08–14: ● PreviousWeekdayFromDate("20080818","thursday") PreviousWeekdayFromDate(mylink.mysourcedate,"thu") SecondsFromTime Returnsthesecondsportionofatime. ●
●
Input:time
●
Output:seconds(dfloat)
Examples.Ifmylink.mytimecontainsthetime22:30:52,thenthetwo followingfunctionsareequivalent,andreturnthevalue52: ● SecondsFromTime("22:30:52") SecondsFromTime(mylink.mytime) SecondsSinceFromTimestamp Returnsthenumberofsecondsbetweentwotimestamps. ●
●
Input:timestamp,timestamp_base
●
Output:seconds(dfloat)
●
Examples.Ifmylink.mytimestampcontainsthetimestamp2008–08–18 22:30:52,andmylink.mytimestamp_basecontainsthetimestamp 2008–08–1922:30:52,thenthetwofollowingfunctionsareequivalent, andreturnthevalue86400:
●
SecondsSinceFromTimestamp("2008–08–1822:30:52","2008–08–19 22:30:52") SecondsSinceFromTimestamp(mylink.mytimestamp, mylink.mytimestamp_base)
TimeDate Returnsthesystemtimeanddateasaformattedstring. ●
Input:
●
Output:systemtimeanddate(string)
●
Examples.Ifthejobwasrunat4.21pmonJune20th2008,thenthe
followingfunctionreturnsthestring"16:21:4820Jun2008". TimeDate() TimeFromComponents Returnsatimefromthegivenhours,minutes,secondsandmicrosecondsgivenas fourseparatevalues. ●
Input:hours(int32),minutes(int32),seconds(int32),microseconds (int32)
●
Output:time
●
Examples.Ifmylink.hourcolcontainsthevalue10,mylink.mincol containsthevalue12,mylink.seccolcontainsthevalue2,and mylink.mseccolcontains0,thenthetwofollowingfunctionsare equivalent,andreturnthetime10:12:02.0: TimeFromComponents(10,12,2,0)
●
TimeFromComponents(mylink.hourcol,mylink.mincol, mylink.seccol,mylink.mseccol)
TimeFromMidnightSeconds Returnsthetimegiventhenumberofsecondssincemidnight. ●
Input:seconds(dfloat)
●
Output:time
Examples.Ifmylink.mymidnightsecondscontainsthevalue240,thenthe twofollowingfunctionsareequivalent,andreturnthevalue00:04:00: ● TimeFromMidnightSeconds("240") TimeFromMidnightSeconds(mylink.mymidnightseconds) TimeOffsetByComponents Returnsthegiventime,withoffsetsappliedfromthegivenhouroffset,minute offset,andsecondoffset,eachgivenasseparatevalues.Thesecondsoffsetcan includepartialseconds. ●
●
Input:basetime(time),hour_offset(int32),minute_offset(int32), second_offset(dfloat)
●
Output:time
●
Examples.Ifmylink.basetimecontains14:05:29andmylink.houros containsthevalue2,mylink.minoscontainsthevalue0,mylink.secos containsthevalue20,thenthetwofollowingfunctionsareequivalent,and returnthetime16:05:49. TimeOffsetByComponents("14:05:29",2,0,20)
●
TimeOffsetByComponents(mylink.basetime,mylink.houros, mylink.minos,mylink.secos)
TimeOffsetBySeconds Returnsthegiventime,withoffsetsappliedfromthegivensecondsoffset.The secondsoffsetcanincludepartialseconds. ●
Input:basetime(time),second_offset(dfloat)
●
Output:time
Examples.Ifmylink.basetimecontains14:05:29.30andmylink.secos containsthevalue2.5,thenthetwofollowingfunctionsareequivalent, andreturnthetime14:05:31.80: ● TimeOffsetByComponents("14:05:29.30",2.5) TimeOffsetByComponents(mylink.basetime,mylink.secos) TimestampFromDateTime Returnsatimestampformthegivendateandtime. ●
●
Input:datetime
●
Output:timestamp
Examples.Ifmylink.mydatecontainsthedate2008–08–18and mylink.mytimecontainsthetime22:30:52,thenthetwofollowing functionsareequivalent,andreturnthetimestamp2008–08–1822:30:52: ● TimestampFromDateTime("2008–08–18","22:30:52") TimestampFromDateTime(mylink.mydate,mylink.mytime) TimestampFromSecondsSince Returnsatimestampderivedfromthenumberofsecondsfromthebase timestamp. ●
●
Input:seconds(dfloat),[base_timestamp]
●
Output:timestamp
●
Examples.Ifmylink.mysecondscontainsthevalue2563and mylink.timestamp_basecontainsthetimestamp2008–08–1822:30:52, thenthetwofollowingfunctionsareequivalent,andreturnthetimestamp 2008–08–1823:13:35: TimestampFromSecondsSince("2563","2008–08–1822:30:52")
●
TimestampFromSecondsSince(mylink.myseconds,mylink.timestamp_b ase)
TimestampFromTimet ReturnsatimestampfromthegivenUNIXtime_tvalue. ●
Input:timet(int32)
●
Output:timestamp
●
Examples.Ifmylink.mytimetcontainsthevalue1234567890,thenthe twofollowingfunctionsareequivalent,andreturnthetimestamp 2009–02–1323:31:30:
●
TimestampFromTimet("1234567890") TimestampFromTimet(mylink.mytimet)
TimestampOffsetByComponents Returnsthegiventimestamp,withoffsetsappliedfromthegivenyearoffset, monthoffset,dayoffset,houroffset,minuteoffset,andsecondoffset,eachgiven asseparatevalues.Thesecondsoffsetcanincludepartialseconds. ● Input:basetimestamp(timestamp),year_offset(int32),month_offset
(int32),dayofmonth_offset(int32),hour_offset(int32),minute_offset (int32),second_offset(dfloat) ●
Output:timestamp
●
Examples.Ifmylink.basetimestampcontains2009081814:05:29and mylink.yearoscontains0,mylink.monthoscontainsthevalue2, mylink.dayoscontainsthevalue4,mylink.houroscontainsthevalue2, mylink.minoscontainsthevalue0,mylink.secoscontainsthevalue20, thenthetwofollowingfunctionsareequivalent,andreturnthetimestamp 2009101416:05:49.
●
TimestampOffsetByComponents("2009081814:05:29",0,2,4, 2,0,20) TimestampOffsetByComponents(mylink.basetimestamp, mylink.houros, mylink.minos,mylink.secos)
●
TimestampOffsetBySeconds Returnsthegiventimestamp,withoffsetsappliedfromthegivensecondsoffset. Thesecondsoffsetcanincludepartialseconds. ●
...