Hi,

something for our aglorithm experts :) :

I want a proc, wich returns me the two dates from Monday to Sunday for a week of a year. For example, week 16 goes from 16.04.2002 to 21.04.2002. Is it possible to calculate the two dates?

Any links/sources/tips are welcome!

Thanks in advance,

bAZiK

something for our aglorithm experts :) :

I want a proc, wich returns me the two dates from Monday to Sunday for a week of a year. For example, week 16 goes from 16.04.2002 to 21.04.2002. Is it possible to calculate the two dates?

Any links/sources/tips are welcome!

Thanks in advance,

bAZiK

I used a similiar algorithm in my DynaBoard Power Forum design. It uses percents of time completed. The easiest way to get a certain day of the year is to get the maximum amount of days in any one year and use that as a greater "whole" percentage... in our case that would be day_of_year/366 (the number is significant only to 3 decimal places, so round for the 3rd place). For years that do not evenly divide by 4, you add 1 for every day past February 28th. This sets up a constant number for each day of the year.

I'm not quite sure what you are asking exactly so I provided an example to work upon. You need to be a little more clear on what you want to do here. From what I gather, you want to calculate either any 2 dates of a given week OR the dates of the ends of each week of the year (Monday = beginning, Sunday = end, for you). It also depends on what you are trying to use as a foundation... are you trying to use the day of the week that January 1st is on as the beginning of the first week of the year or are you using the Monday of the week January 1st lies on?

PS: There is an algorithm section in this forum ;)

I'm not quite sure what you are asking exactly so I provided an example to work upon. You need to be a little more clear on what you want to do here. From what I gather, you want to calculate either any 2 dates of a given week OR the dates of the ends of each week of the year (Monday = beginning, Sunday = end, for you). It also depends on what you are trying to use as a foundation... are you trying to use the day of the week that January 1st is on as the beginning of the first week of the year or are you using the Monday of the week January 1st lies on?

PS: There is an algorithm section in this forum ;)

bAZiK

I convert the date to a julian number then do the math on the julian number.

here's a few links

http://home.capecod.net/~pbaum/date/date0.htm

http://hermetic.magnet.ch/cal_stud.htm

http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html

I convert the date to a julian number then do the math on the julian number.

here's a few links

http://home.capecod.net/~pbaum/date/date0.htm

http://hermetic.magnet.ch/cal_stud.htm

http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html