On 10/30/2013 12:27 PM, urvashi singla wrote: > Hi, > If i execute following computation - > > Next=$(date +%Y%m%d --date="$User 1 day)
> It gives correct result for all except for 20130927. For 20130927 it gives > 20130927 instead of next date i.e. 20130928 I don't understand why is this > so? Is this a bug? No, this is a manifestation of daylight savings. 20130927 happens to have 25 hours in your timezone, but '1 day' only increments by 24 hours. This is a FAQ; to get the behavior you desire, anchor your time to noon rather than the default of midnight (so that even with the fuzz of daylight savings causing 23- or 25-hour days, you still land in the desired destination day). https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
