Day of the week: Difference between revisions

no edit summary
No edit summary
Line 5:
 
Using any standard date handling libraries of your programming language; compare the dates calculated with the output of other languages to discover any anomalies in the handling of dates which may be due to, for example, overflow in types used to represent dates/times similar to [[wp:Y2k#See_also|y2k]] type problems.
 
=={{header|ABAP}}==
<lang ABAP>report zday_of_week
data: lv_start type i value 2007,
lv_n type i value 114,
lv_date type sy-datum,
lv_weekday type string,
lv_day type c,
lv_year type n length 4.
 
write 'December 25 is a Sunday in: '.
do lv_n times.
lv_year = lv_start + sy-index.
concatenate lv_year '12' '25' into lv_date.
call function 'DATE_COMPUTE_DAY'
exporting date = lv_date
importing day = lv_day.
 
select single langt from t246 into lv_weekday
where sprsl = sy-langu and
wotnr = lv_day.
 
if lv_weekday eq 'Sunday'.
write / lv_year.
endif.
enddo.
</lang>
Output:
<pre>
December 25 is a Sunday in:
2011
2016
2022
2033
2039
2044
2050
2061
2067
2072
2078
2089
2095
2101
2107
2112
2118
</pre>
 
=={{header|Ada}}==
Anonymous user