Wednesday, January 22, 2014

Peoplecode and the dates returned from oracle

The built in peoplecode function DATE() claims it needs the format YYYYMMDD however it must automatically strip special characters because if you pass in the standard format Oracle is returning dates in YYYY-MM-DD to this method it works fine.

Here is my sample code that passed and returned the expected values.

Sample

Local date &testDate;
Local number &testYear, &testMonth, &testDay, &testWeekday;
   MessageBox(0, "", 0, 0, " Mess with dates %1 ", &payCalendar.PAY_END_DT.Value);
&testDate = Date(&payCalendar.PAY_END_DT.Value);
&testYear = Year(&testDate);
&testMonth = Month(&testDate);
&testDay = Day(&testDate);
&testWeekday = Weekday(&testDate);
MessageBox(0, "", 0, 0, " date = %5 / Year=%1, Month=%2, Day=%3, Weekday=%4 ", &testYear, &testMonth, &testDay, &testWeekday, &testDate);

Output was


 Mess with dates 2013-01-07  (0,0)
 date = 2013-01-07 / Year=2013, Month=1, Day=7, Weekday=2  (0,0)

No comments:

Post a Comment