arwar49
asked on
delphi DayOfYear
i need to convert DayOfYear --- eg. 249 to str 9/6/2010
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)
so i need function to convert 249 (DOY) to 9/6 (mo/day)
Obviously you need the year, because 249 is different when it is a leap year and when not, right??
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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);
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+day Num;
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?
Result := IncDay(EncodeDate(year, 1, 1), daynum-1);
different to my line
Result := EncodeDate(year,1,1)-1+day
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
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
ASKER