How Many Weeks Has “The Spectator” Been Publishing?

Any other readers of “New Scientist” on this list? In the issue of 3rd Jan, the “Feedback” column tried to work out how many weeks various magazines that are still in existence had been publishing. The oldest they could find was “The Spectator”, which first came out on 6th July 1828. Unfortunately they were using Microsoft Excel to do their calculations, with predictably nonsensical results. :) Here’s what I came up with, using the good old “date” command, together with the arithmetic facilities built into bash. Taking it step by step: date +%s prints out the number of seconds since midnight 1st January 1970 to the present time. date -d "6-Jul-1828" +%s does the same for 6th July 1828. Of course this is a very small negative number. It computes and displays fine on my 64-bit system, but might overflow on 32-bit ones. echo $(($(date +%s) - $(date -d "6-Jul-1828" +%s))) prints out the subtraction of the above two numbers, giving the number of seconds from the founding of “The Spectator” to the present time. And finally, echo $(($(($(date +%s) - $(date -d "6-Jul-1828" +%s))) / $((86400 * 7)))) divides that number of seconds by the number of seconds in a week, giving the number of weeks from the founding of “The Spectator” to the present time. Which, by my reckoning, is 9732.
participants (1)
-
Lawrence D'Oliveiro