bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

date: bug in calculating future dates


From: Christian Hoffmann
Subject: date: bug in calculating future dates
Date: Thu, 03 Aug 2006 17:32:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.13) Gecko/20060411

Hello,

I think, I found a bug:

address@hidden:~ $ date -d "2006-08-07 +83 days"
So Okt 29 00:00:00 CEST 2006
address@hidden:~ $ date -d "2006-08-07 +84 days"
So Okt 29 23:00:00 CET 2006
Two sundays

address@hidden:~ $ date -d "2006-08-07 +230 days"
Sa Mär 24 23:00:00 CET 2007
address@hidden:~ $ date -d "2006-08-07 +231 days"
Mo Mär 26 00:00:00 CEST 2007
Sunday is missing

Greetings

Christian Hoffmann

System:
address@hidden:~ $ uname -a
Linux linux 2.6.13-15.11-default #1 Mon Jul 17 09:43:01 UTC 2006 i686
athlon i386 GNU/Linux
address@hidden:~ $ rpm -qa | grep coreutils
coreutils-5.3.0-20.2
address@hidden:~ $ date --version | head -1
date (GNU coreutils) 5.3.0
address@hidden:~ $ env | grep LANG
LANG=de_DE.UTF-8

Helper script:
#!/bin/bash

wochentag=""
startdatum="2006-08-07"

for((i=1; i < 5000; i++)); do
    wochentagneu=$(date -d "$startdatum +$i day" +%a);
    tagimmonat=$(date -d "$startdatum +$i day" +%d);
    if [ "$wochentagneu" = "$wochentag" ]; then
        echo "$i - $wochentagneu $tagimmonat two times";
    fi;
    if [ "$wochentagneu" = "Mo" -a "$wochentag" = "Sa" ]; then
        echo "$i - So missing";
    fi;
    wochentag=$wochentagneu;
done




reply via email to

[Prev in Thread] Current Thread [Next in Thread]