GNU bug report logs -
#11098
date --yesterday wrong result
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Dear Mister, Madam,
I'm writing to report a date computation problem.
The command "date --date='yesterday' +%Y-%m-%d" launched this morning
between 0:00 am and 0:59 am gives the wrong result:
root <at> serveur:> date --date='today' +%Y-%m-%d; date --date='yesterday'
+%Y-%m-%d
2012-03-26
2012-03-24
This is caused by the system clock changes which happened last night. If we
run the command with full date display format, we can see that UTC+0100
have switch to UTC+0200:
root <at> serveur:> date --date='today'; date --date='yesterday'
lundi 26 mars 2012, 00:27:43 (UTC+0200)
samedi 24 mars 2012, 23:27:43 (UTC+0100)
Without any reference to UTC, "yesterday" means "the day before" and not
"now minus 24 hours". That's the reason why results are good in the full
display format and wrong when we are only displaying the day.
I hope this report will be usefull and want to thank you for any feedback
you could give me about it.
Yours faithfully,
Hugo Guérineau
Expert Génie Logiciel
tel: 06.50.88.43.47
hugo.guerineau <at> wwsight.com
[Message part 2 (text/html, inline)]
This bug report was last modified 6 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.