TIP: Click on subject to list as thread! ANSI
echo: foxpro
to: ALL
from: DAVID POWELL
date: 1997-05-06 08:06:00
subject: Date weirdness

Hi All:
 
Here's an interesting one I encountered today.  (Users do the strangest
things!)
 
Date input, whether with or without CENTURY ON:
 
You know that for the month you can only input 1 through 12.
AND only valid days for each month prevent Fox's "Invalid Date" error.
Have you ever had a user leave the year blank?  I just did.  More than
that, though, she wanted my application to supply the current year
for her!  Bodacious!  So I did.
          ~~~~~~~~~~
If you leave the year blank, Fox assumes 0 and supplies 1900.  Uh-oh.
Gilles???  So I borrowed a bit of Gilles' methodology to resolve a
blank year for a date.  It went into her earlier application in the
VALID clause of the GET as follows:
 
   IF ABS( DATE() - jdWhen ) > 2000   && over 5 years away, 2K days
      jcMon = ALLT( STR( MONT( jdWhen ) ))
      jcDay = ALLT( STR( DAY ( jdWhen ) ))
      jcYr  = ALLT( STR( YEAR( DATE() ) ))
      jdWhen = CTOD( jcMon + "/" + jcDay + "/" + jcYr )
   ENDI
   SHOW GETS
 
Here, jdWhen is the GET variable.  I simply accept the user's month
and day and replace the erroneous year with the current one.  True,
she may be on 01/05/97 and wanted to input 12/30/96, but she can 
easily change the resulting 1997 to 1996.
 
I suppose that this might be a Function in the FPLib(); then all the
date VALIDs could call it.  How about YearBlnk()?  Just make the 
MEMVAR, jdWhen, the PARAMETER.  Maybe it could be combined with the
Y2K function Gilles submitted last year?
 
Gotta run.  There's a bit of Java mess I need to look into.  
David in Dallas.
--- Maximus/2 3.01
---------------
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.