好好工作,好好生活!
2013年(9)
分类: LINUX
2013-05-05 23:54:55
D*--------------------------------------------------------- D* Field Definitions. D*--------------------------------------------------------- D ISOdate S D D USAdate S D DatFmt(*USA) D XMASDate S D Inz(D'2003-12-25')
*----------------------------------------------------------- * RPG-defined date formats and separators for Date data type *----------------------------------------------------------- * 2-Digit Year Formats * *MDY Month/Day/Year mm/dd/yy 8 09/26/03 * *DMY Day/Month/Year dd/mm/yy 8 26/09/03 * *YMD Year/Month/Day yy/mm/dd 8 03/09/26 * *JUL Julian yy/ddd 6 03/926 *---------------------------------------------------------- * 4-Digit Year Formats * *ISO Int Standards Org yyyy-mm-dd 10 2003-09-26 * *USA IBM USA Standard mm/dd/yyyy 10 09/26/2003 * *EUR IBM European Std dd.mm.yyyy 10 26.09.2003 * *JIS Japan Indst Std yyyy-mm-dd 10 2003-09-26 * * *----------------------------------------------------------
C Eval ISOdate = %Date()
C Move ISODate Decimal8 8 0
C Eval WorkISO = ISODate + %Months(1)
C Eval LogonDate = %Date() C Extrct LogonDate:*Y LogYear C Extrct LogonDate:*M LogMonth C Extrct LogonDate:*D LogDay
D MonthNames S 12 Dim(12) CtData C Eval Date_String = C %Trim(MonthNames(LogMonth)) C + %trim('@') + %Trim(LogDay) C + %trim(',@') + %Char(LogYear) C*---------------------------------------------------- ** CTDATA MonthNames January February March April May June July August September October November December
C '@':' ' Xlate Date_String Date_String * * TimeStamp = yyyy-mm-dd-hh.mm.ss.mmmmmm (length 26). * TimeStamp = '2003-09-26-15.16.26.531000' * C Eval TimeStamp = %TimeStamp() * * Free Format date stuff By the way Name2 = 'Friday' * /Free DateIn = %Date() ; ISODate = %Date() ; ISODate = DateIn ; Year = %Subdt(ISODate:*Y) ; Month = %Subdt(ISODate:*M) ; Day = %Subdt(ISODate:*D) ; FromISO = ISODate - %YEARS(1) ; ToISO = ISODate ; DiffDays = %Diff(ToISO:FromISO:*DAYS) ; ISODate = DateIn ; WorkField = %Diff(ISODate:D'1899-12-31':*DAYS); WorkField = %REM(WorkField:7); NamePtr = NamePtr + (WorkField * 9); Name2 = Name; /End-Free * * Build the date string - With The Day Name * DATE_STRING = 'Friday September 26, 2003 ' * C Eval Date_String = C %trim(Name) + %Trim('@@') C + %trim(MonthNames(LogMonth)) C + %trim('@') + %Trim(LogDay) C + %trim(',@') + %Char(LogYear) C Eval Date_String = %Xlate('@':' ':Date_String) * * Calculate the last day of the month * ENDOFMONTH = '2003-09-30' * C ISODate AddDur 1:*Months NextMonth C Extrct NextMonth:*D DiffDays C NextMonth SubDur DiffDays:*D EndOfMonth C Eval *INLR = *On
/free // Convert Date from ccyymmdd to mmddyy Sdt = %uns(%char(%Date(#SoSdt:*Iso):*Mdy0)); // Todays Date in Ccyymmdd format Today = %uns(%char(%Date():*Iso0)); // Convert From Julian to ccyymmdd CbpPayDte = %Dec(%Char(%Date(%Subst(%Editc(Rpdgj:'X'):2:5) :*Jul0):*Iso0):8:0);