Thank You!! But what if I execute this in a London timezone instead in my
timezone?


On Thu, Oct 31, 2013 at 12:05 AM, Eric Blake <[email protected]> wrote:

> 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
>
>

Reply via email to