Bug in date

forum.gupta.bugreport (2005-2010)
Didier Tourneur

Bug in date

Post by Didier Tourneur » 13 Apr 2005, 09:04

 Posted by:  Didier Tourneur 

I have a bug in date in 4.0 and 3.0

dtDebTmp =31-11-2004
if I ad 3 months with
SalDateConstruct( SalDateYear( dtDebTmp ), SalDateMonth( dtDebTmp ) +
nPeriodicite, SalDateDay(dtDebTmp), 0, 0, 0 )
I obtain 30-01-2005

Didier

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 1473
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: Bug in date

Post by Igor Ivanovic » 13 Apr 2005, 10:15

 Posted by:  Igor Ivanovic 

Hi Didier,

Its not a bug. Look at page 2-28 of the Gupta SQLWindows Function
reference:

"If you specify invalid parameter values, an unexpected date
construction can result."

Igor

On Wed, 13 Apr 2005 09:04:14 +0200, "Didier Tourneur"

Didier Tourneur

Re: Bug in date

Post by Didier Tourneur » 13 Apr 2005, 10:18

 Posted by:  Didier Tourneur 

With nPeriodicite=3
if I specify dtDebTmp =31-11-2005 it's ok

but not with the year 2004 because 2004 is leap

StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

Re: Bug in date

Post by StefanM » 13 Apr 2005, 10:56

 Posted by:  Stefan Misch 

Didier,

how did you get
Set dtDebTemp = 31-11-2004
compiled?

I just tried with TD3.1-PTF1 and found

(1) dd-mm-yyyy ist the wrong format for specifying date literals. yyyy-mm-dd
would be correct:
Set dtDebTemp = 2004-11-31

(2) But if I compile this code, I get "Invalid Date/Time" error

So right now I can't understand how you managed to get your code working at
all.

Stefan

Didier Tourneur

Re: Bug in date

Post by Didier Tourneur » 13 Apr 2005, 11:10

 Posted by:  Didier Tourneur 

the first date is good , the format is only to write the message

Clifford Bass

Re: Bug in date

Post by Clifford Bass » 13 Apr 2005, 18:30

 Posted by:  Clifford W. Bass 

Hello Didier,

There is definitely a bug here. Maybe more than one. TD should not
allow you to assign an invalid date. Last I knew, there was no such day as
31 November in 2004, or in any other year for that matter. So if you give
the function a bad date, you should not expect to receive back anything
useful. I am curious to know exactly what the actual value of dtDebTemp is
after you have assigned that invalid date? Does TD change it to 30
November? Something else?

Clifford Bass

StefanM
Germany
Posts: 679
Joined: 10 Aug 2018, 15:57
Location: Bavaria

Re: Bug in date

Post by StefanM » 13 Apr 2005, 19:55

 Posted by:  Stefan Misch 

Didier,

sorry, I still don't get it.
Can you supply a small testcase?
As you see we all have problems to understand how the error is even
possible.

Stefan

RainerE
Germany
Posts: 2278
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: Bug in date

Post by RainerE » 14 Apr 2005, 09:57

 Posted by:  Rainer Ebert 

In my opinion, Didier is right. SalDateConstruct( 2004, 11, 31, 0, 0, 0 )
should result in 2004-12-01. And it does. We use this feature very often, so
Gupta please do not change this, but please correct the leap-year problem.

For your information: My very old digital Casio watch has the same
behaviour.

Rainer

Didier Tourneur

Re: Bug in date

Post by Didier Tourneur » 14 Apr 2005, 10:17

 Posted by:  Didier Tourneur 

I have correct the problem with the function salDateAddmonth from
salextention , because it isn't only this date with a problem

didier

Return to “gupta.bugreport”

Who is online

Users browsing this forum: [Ccbot] and 1 guest