Files
harbour-core/contrib/hbnf/dayofyr.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

56 lines
1.3 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:35:20 GLENN
* Jo French clean up.
*
* Rev 1.2 15 Aug 1991 23:03:08 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.1 10 May 1991 23:59:38 GLENN
* Minor adjustment to header.
*
* Rev 1.0 01 Apr 1991 01:01:02 GLENN
* Nanforum Toolkit
*
*/
FUNCTION ft_DayOfYr( dGivenDate, nDayNum, lIsAcct )
LOCAL nTemp, aRetVal
IF HB_ISNUMERIC( dGivenDate )
nDayNum := dGivenDate
dGivenDate := Date()
ELSEIF HB_ISLOGICAL( dGivenDate )
lIsAcct := dGivenDate
dGivenDate := Date()
ELSEIF ! HB_ISDATE( dGivenDate )
dGivenDate := Date()
ENDIF
IF HB_ISLOGICAL( lIsAcct )
aRetVal := ft_AcctYear( dGivenDate )
ELSE
aRetVal := ft_Year( dGivenDate )
ENDIF
IF HB_ISNUMERIC( nDayNum )
nTemp := aRetVal[ 3 ] - aRetVal[ 2 ] + 1
IF nDayNum < 1 .OR. nDayNum > nTemp
nDayNum := nTemp
ENDIF
aRetVal[ 1 ] := aRetVal[ 2 ] + nDayNum - 1
ELSE
aRetVal[ 1 ] += StrZero( dGivenDate - aRetVal[ 2 ] + 1, 3 )
ENDIF
RETURN aRetVal