On Thu, Aug 25, 2016 at 4:22 PM, Eric Naujock <[email protected]> wrote:
> Is there a simple way to detect 2 digit years stored in the 4D database.
> Much less be able to fix the 2 digit year and convert it to a proper 4
> digit year. I Had a utility that would try to convert is using the
> following. The code runs on 4D v15.2
>
> C_DATE($1;$0)
>
> If (Count parameters=1)
> $0:=Date(String($1;ISO date GMT))
> Else
> $0:=!00-00-00!
> End if
>
This will not help. AFAIK, 4D uses three numbers to store date (day, month
and year.) Your problem is some of dates contain year in range 1 - 99
instead of 1901 - 1999.
What you need is rather something like (this is short idea, adjust it for
your needs)
C_DATE($1;$0)
C_LONGINT($year)
$year:=Year of($1)
Case of
: ($year<15)
$0:=Add to date($1;2000;0;0)
: ($year<100)
$0:=Add to date($1;1900;0;0)
Else
$0:=$1
End if
--
Peter Bozek
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************