date time type differences between vfp5 and vfp6 
Author Message
 date time type differences between vfp5 and vfp6

does anyone know why

in
VISUAL FOXPRO VER. 5  (Command window)
a={02/02/2000}  && when pressing enter key, the date stored to a
b={02/03/2000}  && when pressing enter key, the date stored to b
?=a-b       && result = -1

while
in
VISUAL FOXPRO VER. 6  (Command window)
a={02/02/2000}  && when pressing enter key an error occurs

produces an error
ERROR:
ambiguous date/datetime constant.  Use the format:
  {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

Thanks,



Fri, 09 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
Hi:

VFP 6.0 has been enhanced to provide better support for year 2000
applications.  The example you have given--02/03/2000--is ambiguous; does it
mean February 3, 2000 or March 2, 2000.  If you don't want this error
message just:

SET STRICTDATE TO 0

HTH,

--Paul


Quote:
> does anyone know why

> in
> VISUAL FOXPRO VER. 5  (Command window)
> a={02/02/2000}  && when pressing enter key, the date stored to a
> b={02/03/2000}  && when pressing enter key, the date stored to b
> ?=a-b       && result = -1

> while
> in
> VISUAL FOXPRO VER. 6  (Command window)
> a={02/02/2000}  && when pressing enter key an error occurs

> produces an error
> ERROR:
> ambiguous date/datetime constant.  Use the format:
>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

> Thanks,



Fri, 09 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
I disagree with Paul's recommendation. SET STRICTDATE TO 0 can hide Y2K
problems. Instead, use:

{^2000-02-03}

--

Craig Berntson
MCP, Microsoft FoxPro MVP
eSolutions Services
Salt Lake City Fox User Group
http://members.home.com/foxpro


Quote:
> does anyone know why

> in
> VISUAL FOXPRO VER. 5  (Command window)
> a={02/02/2000}  && when pressing enter key, the date stored to a
> b={02/03/2000}  && when pressing enter key, the date stored to b
> ?=a-b       && result = -1

> while
> in
> VISUAL FOXPRO VER. 6  (Command window)
> a={02/02/2000}  && when pressing enter key an error occurs

> produces an error
> ERROR:
> ambiguous date/datetime constant.  Use the format:
>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

> Thanks,



Fri, 09 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
Paul and Everyone,

Surely this cannot be improved date support, the purpose of the SET DATE
command is to tell foxpro exactly what date format is being used by e.g.
21/02/2000

SET DATE BRITISH
a={21/02/2000}

produces the error message

SET DATE BRITISH
a=ctod('21/02/2000')

works as it should.

The curly brackets, which I seem to remember were introduced to make it
quicker to specify a date, are not checking the SET DATE status, otherwise
fox would know what date was being specified.  It is submitted that it can
only be a bug or undesirable program operation - if not why should foxpro
fail on {} when it works with ctod() ?

Why should STRICTDATE (which I agree works and gives a correct answer of
zero on a-b) make an ambiguous date unambiguous.  Is it a switch to
completely change the operation of the {} ?

Could any Microsoft people shed light on this ?

Gwilym

Quote:
-----Original Message-----

Newsgroups: microsoft.public.fox.programmer.exchange
Date: 21 February 2000 13:06
Subject: Re: date time type differences between vfp5 and vfp6

>Hi:

>VFP 6.0 has been enhanced to provide better support for year 2000
>applications.  The example you have given--02/03/2000--is ambiguous; does
it
>mean February 3, 2000 or March 2, 2000.  If you don't want this error
>message just:

>SET STRICTDATE TO 0

>HTH,

>--Paul



>> does anyone know why

>> in
>> VISUAL FOXPRO VER. 5  (Command window)
>> a={02/02/2000}  && when pressing enter key, the date stored to a
>> b={02/03/2000}  && when pressing enter key, the date stored to b
>> ?=a-b       && result = -1

>> while
>> in
>> VISUAL FOXPRO VER. 6  (Command window)
>> a={02/02/2000}  && when pressing enter key an error occurs

>> produces an error
>> ERROR:
>> ambiguous date/datetime constant.  Use the format:
>>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

>> Thanks,


>Hi:

>VFP 6.0 has been enhanced to provide better support for year 2000
>applications.  The example you have given--02/03/2000--is ambiguous; does
it
>mean February 3, 2000 or March 2, 2000.  If you don't want this error
>message just:

>SET STRICTDATE TO 0

>HTH,

>--Paul



>> does anyone know why

>> in
>> VISUAL FOXPRO VER. 5  (Command window)
>> a={02/02/2000}  && when pressing enter key, the date stored to a
>> b={02/03/2000}  && when pressing enter key, the date stored to b
>> ?=a-b       && result = -1

>> while
>> in
>> VISUAL FOXPRO VER. 6  (Command window)
>> a={02/02/2000}  && when pressing enter key an error occurs

>> produces an error
>> ERROR:
>> ambiguous date/datetime constant.  Use the format:
>>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

>> Thanks,



Fri, 09 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
Gwilym
 SET DATE BRITISH
 a=ctod('21/02/2000')
does produce an error if you SET STRICTDATE TO 2.
The improvement is that we can catch and avois date literals or strings that
depend on a particular SET DATE, that's the ambiguity. Another improvement
is the date function DATE(year, month, day), which doesn't accept 2-digit
years. It does go down to the year 100.
-Anders


Quote:
> Paul and Everyone,

> Surely this cannot be improved date support, the purpose of the SET DATE
> command is to tell foxpro exactly what date format is being used by e.g.
> 21/02/2000

> SET DATE BRITISH
> a={21/02/2000}

> produces the error message

> SET DATE BRITISH
> a=ctod('21/02/2000')

> works as it should.

> The curly brackets, which I seem to remember were introduced to make it
> quicker to specify a date, are not checking the SET DATE status, otherwise
> fox would know what date was being specified.  It is submitted that it can
> only be a bug or undesirable program operation - if not why should foxpro
> fail on {} when it works with ctod() ?

> Why should STRICTDATE (which I agree works and gives a correct answer of
> zero on a-b) make an ambiguous date unambiguous.  Is it a switch to
> completely change the operation of the {} ?

> Could any Microsoft people shed light on this ?

> Gwilym

> -----Original Message-----

> Newsgroups: microsoft.public.fox.programmer.exchange
> Date: 21 February 2000 13:06
> Subject: Re: date time type differences between vfp5 and vfp6

> >Hi:

> >VFP 6.0 has been enhanced to provide better support for year 2000
> >applications.  The example you have given--02/03/2000--is ambiguous; does
> it
> >mean February 3, 2000 or March 2, 2000.  If you don't want this error
> >message just:

> >SET STRICTDATE TO 0

> >HTH,

> >--Paul



> >> does anyone know why

> >> in
> >> VISUAL FOXPRO VER. 5  (Command window)
> >> a={02/02/2000}  && when pressing enter key, the date stored to a
> >> b={02/03/2000}  && when pressing enter key, the date stored to b
> >> ?=a-b       && result = -1

> >> while
> >> in
> >> VISUAL FOXPRO VER. 6  (Command window)
> >> a={02/02/2000}  && when pressing enter key an error occurs

> >> produces an error
> >> ERROR:
> >> ambiguous date/datetime constant.  Use the format:
> >>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

> >> Thanks,


> >Hi:

> >VFP 6.0 has been enhanced to provide better support for year 2000
> >applications.  The example you have given--02/03/2000--is ambiguous; does
> it
> >mean February 3, 2000 or March 2, 2000.  If you don't want this error
> >message just:

> >SET STRICTDATE TO 0

> >HTH,

> >--Paul



> >> does anyone know why

> >> in
> >> VISUAL FOXPRO VER. 5  (Command window)
> >> a={02/02/2000}  && when pressing enter key, the date stored to a
> >> b={02/03/2000}  && when pressing enter key, the date stored to b
> >> ?=a-b       && result = -1

> >> while
> >> in
> >> VISUAL FOXPRO VER. 6  (Command window)
> >> a={02/02/2000}  && when pressing enter key an error occurs

> >> produces an error
> >> ERROR:
> >> ambiguous date/datetime constant.  Use the format:
> >>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

> >> Thanks,



Fri, 09 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6

Quote:

>I disagree with Paul's recommendation. SET STRICTDATE TO 0 can hide Y2K
>problems. Instead, use:

>{^2000-02-03}

     Unfortunately, this doesn't work in filter expressions.  The
filter expression ends up not having the caret and VFP complains
unless set strictdate to 0.

[snipped previous]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
     I have preferences.
     You have biases.
     He/She has prejudices.



Sat, 10 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
Thanks Anders, that does open up a new perspective on the subject

 - but where does it leave us when our clients expect to enter dates in
their native format which depends on SET DATE and would object most strongly
if we insisted they enter yyyy-mm-dd into a date field

It seems as if MicroSoft may have solved an existing problem but created a
new one by ignoring SET DATE which is concerned with locale not with year
2000

Quote:

>Gwilym
> SET DATE BRITISH
> a=ctod('21/02/2000')
>does produce an error if you SET STRICTDATE TO 2.
>The improvement is that we can catch and avois date literals or strings
that
>depend on a particular SET DATE, that's the ambiguity. Another improvement
>is the date function DATE(year, month, day), which doesn't accept 2-digit
>years. It does go down to the year 100.
>-Anders

[previous snipped]


Sat, 10 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
You can use DATE(year,month,day) in filters - no complaints.
-Anders


Quote:

> >I disagree with Paul's recommendation. SET STRICTDATE TO 0 can hide Y2K
> >problems. Instead, use:

> >{^2000-02-03}

>      Unfortunately, this doesn't work in filter expressions.  The
> filter expression ends up not having the caret and VFP complains
> unless set strictdate to 0.

> [snipped previous]

> Sincerely,

> Gene Wirchenko

> Computerese Irregular Verb Conjugation:
>      I have preferences.
>      You have biases.
>      He/She has prejudices.



Sat, 10 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
Gwilym

The user will pick dates from a calender or type them in a textbox as per
usual:
FUNCTION Valid
LOCAL lnYear, lnMonth, lnDay
lnYear = YEAR(This.value)
lnMonth = MONTH(This.Value)
lnDay= DAY(this.Value)
REQUERY('theview')

the view'd defined with:
CREATE VIEW theview AS ;K
SELECT * FROM Table WHERE date = DATE(?lnYear,?lnMonth,?lnDay)
or for a query
 SELECT ... WHERE date => DATE(lnYear,lnMonth,lnDay) INTO CURSOR Q

If the user is typing in dates you can force four-digit entry and check
This.Text in the Valid to see if there are four digits in the year part. You
can also check that in KeyPress.

-Anders


Quote:
> Thanks Anders, that does open up a new perspective on the subject

>  - but where does it leave us when our clients expect to enter dates in
> their native format which depends on SET DATE and would object most
strongly
> if we insisted they enter yyyy-mm-dd into a date field

> It seems as if MicroSoft may have solved an existing problem but created a
> new one by ignoring SET DATE which is concerned with locale not with year
> 2000


> >Gwilym
> > SET DATE BRITISH
> > a=ctod('21/02/2000')
> >does produce an error if you SET STRICTDATE TO 2.
> >The improvement is that we can catch and avois date literals or strings
> that
> >depend on a particular SET DATE, that's the ambiguity. Another
improvement
> >is the date function DATE(year, month, day), which doesn't accept 2-digit
> >years. It does go down to the year 100.
> >-Anders

> [previous snipped]



Sat, 10 Aug 2002 03:00:00 GMT  
 date time type differences between vfp5 and vfp6
Gwilym,

One other significant problem solved by VFP6 and the the new strict date
deals with the compilation of {} constants being affected by the SET DATE in
effect at compile time, which might be different that the runtime SET DATE
which means the constants can be out of synch.

Compile this code with
SET STRICTDATE 0
SET DATE AMERICAN

function SetDateTest( pdTest )

a = {2/21/2000}

return ( pdTest < a )

run it from the command window to test it.

? SetDateTest( {2/22/2000} )
? SetDateTest( {2/21/2000} )
? SetDateTest( {2/20/2000} )

Then SET DATE BRITISH and rerun the same tests and it will fail.

because 22,21,20 are not valid months. Now go edit the code by putting just
a space in it and run again. Now it will always return .f. because the
2/21/2000 date compiled as { / / } because it's invalid under the changed
SET DATE that was in effect at compile time.

These kinds of problems are near impossible to find during development. If
you are doing multinational development use strictdate 2 and change all of
your date constants and you will not have these kinds of problems.
--
df    - (Microsoft FoxPro MVP)
http://www.geocities.com/ResearchTriangle/9834/


Quote:
> Paul and Everyone,

> Surely this cannot be improved date support, the purpose of the SET DATE
> command is to tell foxpro exactly what date format is being used by e.g.
> 21/02/2000

> SET DATE BRITISH
> a={21/02/2000}

> produces the error message

> SET DATE BRITISH
> a=ctod('21/02/2000')

> works as it should.

> The curly brackets, which I seem to remember were introduced to make it
> quicker to specify a date, are not checking the SET DATE status, otherwise
> fox would know what date was being specified.  It is submitted that it can
> only be a bug or undesirable program operation - if not why should foxpro
> fail on {} when it works with ctod() ?

> Why should STRICTDATE (which I agree works and gives a correct answer of
> zero on a-b) make an ambiguous date unambiguous.  Is it a switch to
> completely change the operation of the {} ?

> Could any Microsoft people shed light on this ?

> Gwilym

> -----Original Message-----

> Newsgroups: microsoft.public.fox.programmer.exchange
> Date: 21 February 2000 13:06
> Subject: Re: date time type differences between vfp5 and vfp6

> >Hi:

> >VFP 6.0 has been enhanced to provide better support for year 2000
> >applications.  The example you have given--02/03/2000--is ambiguous; does
> it
> >mean February 3, 2000 or March 2, 2000.  If you don't want this error
> >message just:

> >SET STRICTDATE TO 0

> >HTH,

> >--Paul



> >> does anyone know why

> >> in
> >> VISUAL FOXPRO VER. 5  (Command window)
> >> a={02/02/2000}  && when pressing enter key, the date stored to a
> >> b={02/03/2000}  && when pressing enter key, the date stored to b
> >> ?=a-b       && result = -1

> >> while
> >> in
> >> VISUAL FOXPRO VER. 6  (Command window)
> >> a={02/02/2000}  && when pressing enter key an error occurs

> >> produces an error
> >> ERROR:
> >> ambiguous date/datetime constant.  Use the format:
> >>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

> >> Thanks,


> >Hi:

> >VFP 6.0 has been enhanced to provide better support for year 2000
> >applications.  The example you have given--02/03/2000--is ambiguous; does
> it
> >mean February 3, 2000 or March 2, 2000.  If you don't want this error
> >message just:

> >SET STRICTDATE TO 0

> >HTH,

> >--Paul



> >> does anyone know why

> >> in
> >> VISUAL FOXPRO VER. 5  (Command window)
> >> a={02/02/2000}  && when pressing enter key, the date stored to a
> >> b={02/03/2000}  && when pressing enter key, the date stored to b
> >> ?=a-b       && result = -1

> >> while
> >> in
> >> VISUAL FOXPRO VER. 6  (Command window)
> >> a={02/02/2000}  && when pressing enter key an error occurs

> >> produces an error
> >> ERROR:
> >> ambiguous date/datetime constant.  Use the format:
> >>   {^yyy-mm-dd [hh[:mm[:ss]] [alp]]}

> >> Thanks,



Sun, 11 Aug 2002 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Date Time differences?

2. Tooltiptext difference between vfp5 and vfp6

3. Network Server Date/Time from VFP5

4. Network Server Date/Time from within VFP5

5. Network Server Date/Time from VFP5?

6. Network Server Date/Time from within VFP5

7. VFP6 - Touch File Date and Time

8. Date & Time stamping at compile time

9. time difference

10. Time Difference

11. date difference

12. Way to figure out number of months difference between two dates

 

 
Powered by phpBB® Forum Software