Page 1 of 1

day of year

Posted: Mon Jun 19, 2006 10:08 pm
by patili
Hi,
i am looking about a function which returns the numeric value of the day in the year
ex function (01/01/06) return 1
function (31/12/06) reutrn 365
May be this function exist but i don't find it
Any idea? Thanks

Re: day of year

Posted: Mon Jun 19, 2006 10:23 pm
by wmormar
patili wrote:Hi,
i am looking about a function which returns the numeric value of the day in the year
ex function (01/01/06) return 1
function (31/12/06) reutrn 365
May be this function exist but i don't find it
Any idea? Thanks
If use xHarbour

Code: Select all

DOY ([<dDate>])

Posted: Mon Jun 19, 2006 10:49 pm
by patili
No i'm using Fivewin and clipper

Posted: Mon Jun 19, 2006 11:19 pm
by Antonio Linares
Patili,

Code: Select all

function Main()

   SET DATE FRENCH

   MsgInfo( Doy( CToD( "01/01/06" ) ) )

   MsgInfo( Doy( CToD( "31/12/06" ) ) )
   
return nil   

function DOY( dDate )

   local nMonth := Month( dDate )
   local nDay := 0
   
   while nMonth > 0 
      nDay += Day( dDate )
      dDate -= Day( dDate )
      nMonth--
   end
   
return nDay      

Posted: Tue Jun 20, 2006 6:05 am
by patili
And NOW it exist
Thank you Antonio

Posted: Tue Jun 20, 2006 5:30 pm
by Antonio Linares
You are welcome :)