×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Here's an ILE procedure that uses Zellers congruence.


**************************************************************************

* Return Day of Week - Use Zeller's congruence
* Returns an integer with the day number of the year
* 0 = Monday, 1 = Tuesday 2 = Wednesday, etc.

**************************************************************************

P getDayOfWeek B Export
D getDayOfWeek PI 10i 0
D InDate d const datfmt(*iso)
*
D nDay s 10i 0
D nMonth s 10i 0
D nYear s 10i 0
D nDayOfWeek s 10i 0
*
/free

nDay = %subdt(InDate:*days);
nMonth = %subdt(InDate:*months);
nYear = %subdt(InDate:*years);
if nMonth < 3;
nMonth = nMonth + 12;
nYear = nYear - 1;
endif;

nDayOfWeek = %rem(%int((13 * nMonth + 3) / 5) + nDay + nYear +
%int(nYear / 4) - %int(nYear / 100) +
%int(nYear / 400) : 7);

return nDayOfWeek;
/end-free
P getDayOfWeek E

James R. Perkins




James Lampert <jamesl@xxxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
26.09.2007 17:20
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Day of the Week?







Is there an easy way for an ILE RPG program to find out the current day
of the week?

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.