bug#12650: Bug in date command

2012-10-14 Thread Thiago Picharski
Hello,

I'm trying run this command "date -d 12-10-21", but occur the follow
error, date: invalid date "12-10-21"
and finalize with error code 1.

Interestingly, when i run "date -d 12-10-20" or "date -d 12-10-22" this
work fine.

Thanks!

Thiago H. S. Picharski


bug#12650: Bug in date command

2012-10-14 Thread Bob Proulx
tags 12650 + moreinfo
thanks

Thiago Picharski wrote:
> I'm trying run this command "date -d 12-10-21", but occur the follow
> error, date: invalid date "12-10-21"
> and finalize with error code 1.

What timezone are you in?  Almost certainly that timezone experienced
a daylight savings time change and the time you are asking about does
not exist, is invalid.  "Spring forward and Fall back."  When DST
jumps forward then some times will not exist by act of law, not
technology.  Technology says use UTC but people like local time to
change from place to place.  :-)

Please read this reference and let us know if it covers your case or
not.

  
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

The basic problem is that when you specify 12-10-21 it means 
hours.  That is often when DST changes.  Better to specify noon
instead which is far from when DST changes.

  $ date -d "12-10-21 12:00"

Best would be to work in UTC to avoid DST issues entirely.

  $ date -u -d "12-10-21 12:00 UTC"

> Interestingly, when i run "date -d 12-10-20" or "date -d 12-10-22" this
> work fine.

Very likely those dates are valid.  Since you didn't say what timezone
you are working in I can't look to see what was happening there.

Bob





bug#12650: Bug in date command

2018-10-23 Thread Assaf Gordon

close 12650
stop

(triaging old bugs)

On 14/10/12 05:28 PM, Bob Proulx wrote:


Thiago Picharski wrote:

I'm trying run this command "date -d 12-10-21", but occur the follow
error, date: invalid date "12-10-21"
and finalize with error code 1.


[...]
The basic problem is that when you specify 12-10-21 it means 
hours.  That is often when DST changes.  Better to specify noon
instead which is far from when DST changes.


[...]

Very likely those dates are valid.  Since you didn't say what timezone
you are working in I can't look to see what was happening there.



With no further comments to Bob's explanation in 6 years,
I'm closing this bug.

-assaf