# Date Question

#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
Hi,

We have an aplication which shows a menu displaying Thursday, Friday
and Saturday only along with the week ending date (Saturday's date).
To do this we used the following command:

\$weekno = (date ("W"));
\$year = (date ("Y"));
\$dates[1] = (date('m/d/Y', mktime(0,0,0,1,(\$weekno-1)*7+ (4 -
JDDayOfWeek((\$weekno -1) * 7)),\$date)));
\$dates[2] = (date('m/d/Y', mktime(0,0,0,1,(\$weekno-1)*7+ (5 -
JDDayOfWeek((\$weekno -1) * 7)),\$year)));
\$dates[3] = (date('m/d/Y', mktime(0,0,0,1,(\$weekno-1)*7+ (6 -
JDDayOfWeek((\$weekno -1) * 7)),\$year)));

That worked fine in 2008....but now it is all messed up and rather
than showing Thursday, Friday and Saturday with the proper dates, it
shows Saturday, Sunday & Monday with a week ending date of the 5th,
being Monday.

I'm trying to understand this command, but maybe someone has something
easier?  We'd like to to work all year round, across new years
too......

Thanks!

## Re: Date Question

mrdjmagnet@aol.com wrote:

Your code will always return 3rd, 4th and 5th for January, no matter
what the year.  That's because the expression

(\$weekno -1) * 7)

always returns a multiple of 7.  So the expression

JDDayOfWeek((\$weekno -1) * 7)

always returns s (days are numbered 0-6).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Date Question

Well, it seems to return 3, 4, & 5 rather than 1, 2 & 3, which is what
we want since that is the Thursday, Friday & Saturday.  3, 4, 5 is
Saturday, Sunday & Monday.....

Maybe just an IF statement to test for the first week of the year and
change the numbers accordingly.....

## Re: Date Question

mrdjmagnet@aol.com wrote:

No, your entire expression is incorrect.  It looks like whoever wrote it
got it to work for 2008, but it will ALWAYS show the same dates (for the
entire year) - no matter what the year is.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Date Question

Well, do can you show me a fix for 2009???

## Re: Date Question

mrdjmagnet@aol.com wrote:

Can you try it yourself?

There is no "fix for 2009" - the whole expression needs to be reworked.
And here, we help people who try to do things themselves.  If you want
someone to do it for you, I'm sure there are several who will do it for
the right price.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Date Question

Thank dork, but I obviously tried it myself and could not get it,
which is why I posted here......

## Re: Date Question

mrdjmagnet@aol.com wrote:

OK, asshole.  I told you what was wrong.  With that attitude, that's the

Now if you would have posted your attempts with some questions on how to
fix it, you would have gotten some help.  But not any more.

You're obviously too incompetent to be programming.  I suggest you hire
someone.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Date Question

Jerry Stuckle wrote:

Oh the irony of it.
Pots and kettles.