Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge: Compute the number of Tuesdays since a given date
#16
Xhantt,

I looked up the FIX command. For positive numbers it's the same as using an INT. For negative numbers it truncates the decimals, whereas INT will truncate but increment the whole number part by one.

However, your code still has a problem. Your statement:

PRINT "Han pasado "; FIX(dias / 7); " jueves"

will print the truncated number of weeks between the two dates. The number of weeks is not necessarily the number of Tuesdays or Thurdays that transpired, because the first date could have started on a Tuesday and the end date could end on a Wednesday which means that you have 2 extra Tuesdays in the count.

You need to add a little routine that computes the day of the week for a given value which you call JulianDate#.

I suggest you do some more testing with real, small dates that can be checked manually with a calendar.
*****
Reply


Messages In This Thread
Challenge: Compute the number of Tuesdays since a given date - by Moneo - 06-14-2004, 05:02 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)