[futurebasic] Re: [FB] Code to calculate day of the year

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2011 : Group Archive : Group : All Groups

From: Steve <mactech@...>
Date: Tue, 24 May 2011 19:12:18 -0400
thanks.  I see now where I made my mistake

On May 24, 2011, at 6:44 PM, Robert Purves wrote:

> 
> Steve wrote:
> 
>> Can someone provide an updated example of the changes needed in this example below, which works in FB4 but not FB5?
> 
> 
> '---------------
> include "Tlbx CFDate.incl"
> include "Tlbx CFTimeZone.incl"
> 
> include "ConsoleWindow"
> 
> local fn DayOfYearGetDate( dayNumber as SInt32, year as SInt32 ) as CFGregorianDate
> '~'1
> dim as CFTimeZoneRef     zone
> dim as CFAbsolutetime    absTime
> dim as CFGregorianUnits  units
> dim as CFGregorianDate   date
> 
> BlockZero( @date, sizeof( date ) )
> BlockZero( @units, sizeof( units ) )
> zone = fn CFTimeZoneCopySystem()
> date.year = year
> absTime = fn CFGregorianDateGetAbsoluteTime( date, zone )
> units.days = dayNumber
> absTime = fn CFAbsoluteTimeAddGregorianUnits( absTime, zone, units )
> date = fn CFAbsoluteTimeGetGregorianDate( absTime, zone )
> CFRelease( zone )
> end fn = date
> 
> 
> dim as CFGregorianDate d
> 
> d = fn DayOfYearGetDate( 366, 2008 )
> print d.day, d.month, d.year
> '---------------
> 
> Robert P.
> 
> 
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
> To access the list archives, go to:  http://freegroups.net/groups/futurebasic/
>