Peter Bissmire

Communications & Language Services

Technical and general translations, French/German -> English

This self-updating, perpetual calendar, such as you might find on a bookings site, is created with PHP.
The full Gregorian leap year formula is implemented. It is set to cover 547 days (18 months) and, with javaScript, it is refreshed every 10 minutes.

php Sunday (Su), 05 May, 16:27:19 CEST

May 2024
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
2728293031

Using javaScript, it is relatively easy to show an arbitrary number of months. Only the calendar is changed, the rest of the page remaining static, and the speed of stepping through the calendar is limited only by your viewing device. Using HTML links, one month at a time is easiest and the whole page must be reloaded at each step.

There is also a potential debate regarding the use of PHP. The HTML is generated in loops and conditional statements and thus fully entangled in the code. It could therefore just as well be generated by a CGI script. The most cogent argument turns around which is faster and which uses the more resources. The practical difference in speed and resources, however, is so small as to be significant only on a very busy server. Security might also be considered.

In the noscript situation, refresh has to be by a full page reload — client-side (deprecated meta tag) or server-side (potential side-effects).

Cache control — caching can turn refreshes into "defreshes". .