Day of the week: Difference between revisions

→‎{{header|UNIX Shell}}: max date now 2121
(php)
(→‎{{header|UNIX Shell}}: max date now 2121)
Line 275:
<pre>#! /bin/bash
 
for((i=2009; i <= 20992121; i++))
do
date -d "$i-12-25" |grep Sun
Line 295:
I.e., starting from year 2038, the <tt>date</tt> command (which uses the glibc library, at least on GNU systems), is not able to recognise the date as a valid one!
 
===Different machine/OS version #1(64 bit)===
This is the same command run on RedHat Linux.
<pre>bash-3.00$ date --version
Line 306:
bash-3.00$ uname -a
Linux brslln01 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
bash-3.00$ for((i=2009; i <= 20992121; i++)); do date -d "$i-12-25" |egrep Sun; done
Sun Dec 25 00:00:00 GMT 2011
Sun Dec 25 00:00:00 GMT 2016
Line 320:
Sun Dec 25 00:00:00 GMT 2089
Sun Dec 25 00:00:00 GMT 2095
Sun Dec 25 00:00:00 GMT 2101
Sun Dec 25 00:00:00 GMT 2107
Sun Dec 25 00:00:00 GMT 2112
Sun Dec 25 00:00:00 GMT 2118
bash-3.00$</pre>
Anonymous user