Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET STRICTDATE Command - App Advice

Status
Not open for further replies.

FoxEgg

Programmer
Joined
Mar 24, 2002
Messages
749
Location
AU
Quick one

Should I (Do I need to ) use SET CENTURY AS WELL AS the
SET STRICTDATE Command in my setup prg

if so should I use SET STRICTDATE 0, 1, or 2 for regular program useage...

Seems I should use SET STRICTDATE = 1 Command ONLY

Suggestions this Sunday am ?

John

PS we had 112 degrees here today !!!! Not good for programming.

Also the fact that the search engine is down makes you appreciate the hard work that the Tek-Tips site people do... when you don't have something as valuable as that...

just imagine if the VFP Forum went down...

Thanks Tek-Tips Site... (maybe you should consider voting for yourself as Tek-Tipster of the Week)
 
John

What a difference a country makes, its about -5 here.

Here is some differences, try this:
SET STRICTDATE TO 1
? CTOD("01/10/01")
SET STRICTDATE TO 2
? CTOD("01/10/01")

The second one generates an error.
I would not use Set strictdate as it is restrictive, I would use
SET CENTURY ON
SET STRICTDATE TO
SET DATE DMY (or whatever)
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
John,
SET CENTURY is not required for STRICTDATE. Since having Strictdate set to 1 or 2, when using date/time fields will require the entry of 4 digit year, STRICTDATE = 0 is the only format that allows you to "Omit" the full year. In either case, SET CENTURY only affects the number of digits displayed in the year. That is fine for output, but entry will require the full 4 digit year entry.
Even on that note, Fox has done a lot to "Anticipate" what you mean by the year. For instance, in 2.x if you put in 00, it would assume 1900, but in VFP, 00 will yeild for you 2000. Best to stick with STRICTDATE 1 or 2, and enter the full year.
Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Thanks...

And I thought that I was stuggling with the concept of StrictDate... BEFORE I MADE THE POST

I read and saw all the stuff about the error messages ... with the STRICTDATE = 2 option.... (so that did not seem a good idea)

So, at this point, Mike's post suggests that I will not use STRICT DATE AT ALL (I like that idea)

and Scott, you suggest a STRICTDATE = 1 Option and that

SET CENTURY is not required for STRICTDATE. Since having Strictdate set to 1 or 2, when using date/time fields will require the entry of 4 digit year


Mmmmmm !!!

BUT Scott, when I use


SET strictdate to 2
SET CENTURY ON
? DATETIME( )


I get 2003

And when


SET strictdate to 2
SET CENTURY off
? DATETIME( )

I get 03

So think I need the SET CENTURY ON and THE STRICTDATE = 1 as well, cos I want 2003 etc etc

Cheers

JF
 
John,
You missed my point about century. Century affects the DISPLAY of the date, not the ENTRY of the date. With strict date = 1, as Mike mentioned, you can't use as input to a date filed something like:
myDate = {10/01/03} you will get an error.

you must specify it as:

myDate = {^2003-01-10} (yyyy-mm-dd}

Functions that you passed such as DATETIME() automatically pass Fox the date in the proper format according to the settings of STRICTDATE. There is a saying in the FoxPro community that SET STRICTDATE TO 0 could just as easily be named SET DATE BUGS ON. I highly recommend against using STRICTDATE = 0. There are a number of other "Odities" that come with it.

In addition, the result of Mike's CTOD function, if you look under TOOLS, OPTIONS, GENERAL, the Year 2000 Compliance field, you'll see the STRICT DATE options in a drop down, which expressly metions that with STRICTDATE = 2, it affect CTOD AND CTOT functions, where under STRICTDATE 1, they do not. This is really a minor point, and only requires as well that when using the CTOD or CTOT function, that you ensure that if you are passing it a date or date/time value, it must be in the proper format.

Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Ok so as I see it

#1 we should all be using strictdate = 1

AND

#2 we should all enter all dates in the ...

myDate = {^2003-01-10} && (yyyy-mm-dd}

format...

No problem...,

I only hope that I can still use the date data stored in my existing databases (as I am intending to use them)

Thanks Everyone.....

Appreciate the asssiatnce

John


 
John,
Dates in real "Date" fields are considered already "Validated" (no pun intended), so moving date field to date field is no problem. Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top