Link to home
Start Free TrialLog in
Avatar of arwar49
arwar49

asked on

delphi DayOfYear

i need to convert DayOfYear ---  eg. 249 to str 9/6/2010
Avatar of arwar49
arwar49

ASKER

this should be pretty straightforward - i just have a coder's block at the moment.
Avatar of arwar49

ASKER

i guess the 2010 is not part of DayOfYear - i said i had coder' s block

so i need function to convert 249 (DOY) to 9/6 (mo/day)
Avatar of cyberkiwi
Obviously you need the year, because 249 is different when it is a leap year and when not, right??
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arwar49

ASKER

ok
why not look in the DateUtils unit next time ?

There is the incday function which should be the easiest

Result := IncDay(EncodeDate(year, 1, 1), daynum-1);
How is your line

Result := IncDay(EncodeDate(year, 1, 1), daynum-1);

different to my line

Result := EncodeDate(year,1,1)-1+dayNum;

which skips the function and uses floating point register directly.
The other content of the function is only to default to current year.

Unless there is some magic to IncDay that I am not aware of?
it is not different cyberkiwi,
i was more responding to forgetting things and having blackouts (usually monday morning)

the best to thing then is to look in those units for some unblocking ideas