Files
harbour-core/contrib/hbnf/year.prg
vszakats 9687850865 2013-03-16 02:10 UTC+0100 Viktor Szakats (harbour syenar.net)
* (all files)
    * stripped svn header
    * minor cleanups
    ; use following command to find out the history of files:
       git log
       git log --follow
       git blame
       git annotate
2013-03-16 02:11:42 +01:00

43 lines
1.1 KiB
Plaintext

/*
* Author....: Jo W. French dba Practical Computing
* CIS_ID....: 74731,1751
*
* The functions contained herein are the original work of Jo W. French
* and are placed in the public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.3 28 Sep 1992 00:45:50 GLENN
* Jo French cleaned up.
*
* Rev 1.2 15 Aug 1991 23:04:56 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.1 14 Jun 1991 19:53:20 GLENN
* Minor edit to file header
*
* Rev 1.0 01 Apr 1991 01:02:36 GLENN
* Nanforum Toolkit
*
*/
FUNCTION ft_Year( dGivenDate )
LOCAL aRetVal[ 3 ]
LOCAL cFY_Start := ft_DateCnfg()[ 1 ]
IF ! HB_ISDATE( dGivenDate )
dGivenDate := Date()
ENDIF
aRetVal[ 2 ] := hb_SToD( ;
StrZero( Year( dGivenDate ) - iif( Month( dGivenDate ) < Month( hb_CToD( cFY_Start, "yyyy.mm.dd" ) ), 1, 0 ), 4 ) + ;
SubStr( cFY_Start, 6, 2 ) + ;
SubStr( cFY_Start, 9, 6 ) )
aRetval[ 3 ] := ft_MAdd( aRetVal[ 2 ], 12 ) - 1
aRetVal[ 1 ] := Str( Year( aRetVal[ 3 ] ), 4 ) // End of Year
RETURN aRetVal