[prev in list] [next in list] [prev in thread] [next in thread]
List: coreutils
Subject: Re: Date Computations cot executing properly!!
From: urvashi singla <urvi0109 () gmail ! com>
Date: 2013-10-30 18:56:46
Message-ID: CAAFXGPmkFJF9kF5CN+_nnQGLK9Sxuw5ejEoROuoFN1vWb2g8Sg () mail ! gmail ! com
[Download RAW message or body]
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 <eblake@redhat.com> 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
>
>
[Attachment #3 (text/html)]
<div dir="ltr">Thank You!! But what if I execute this in a London timezone instead in \
my timezone? </div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, \
Oct 31, 2013 at 12:05 AM, Eric Blake <span dir="ltr"><<a \
href="mailto:eblake@redhat.com" target="_blank">eblake@redhat.com</a>></span> \
wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div class="im">On 10/30/2013 12:27 PM, urvashi singla \
wrote:<br> > Hi,<br>
> If i execute following computation -<br>
><br>
> Next=$(date +%Y%m%d --date="$User 1 day)<br>
<br>
</div><div class="im">> It gives correct result for all except for 20130927. For \
20130927 it gives<br> > 20130927 instead of next date i.e. 20130928 I don't \
understand why is this<br> > so? Is this a bug?<br>
<br>
</div>No, this is a manifestation of daylight savings. 20130927 happens to<br>
have 25 hours in your timezone, but '1 day' only increments by 24 hours.<br>
This is a FAQ; to get the behavior you desire, anchor your time to noon<br>
rather than the default of midnight (so that even with the fuzz of<br>
daylight savings causing 23- or 25-hour days, you still land in the<br>
desired destination day).<br>
<br>
<a href="https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e" \
target="_blank">https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Eric Blake eblake redhat com +1-919-301-3266<br>
Libvirt virtualization library <a href="http://libvirt.org" \
target="_blank">http://libvirt.org</a><br> <br>
</font></span></blockquote></div><br></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic