Taking the date with the number of week's day

Hello,

<option value="0"> Sunday </ option>
<option value="1"> Monday </ option>
<option value="2"> Tuesday </ option>
<option value="3"> Wednesday </ option>
<option value="4"> Thursday </ option>
<option value="5"> Friday </ option>
<option value="6"> Saturday </ option>

I want to take the nearest date with the number of week’s day which I gived.

If the number of week is today, and the hour and minute haven’t passed the current time yet, I want to take the date of today.

Can you help me?

I don’t know the code below works for this ???
[php]
$week = 3;
$hour = 23;
$minute = 26;
$second = 00;
$month = date(‘n’);
$day = date(‘j’);
$year = date(‘Y’);

    $timestamp = mktime( $hour, $minute, $second, $month, $day,  $year ) + ( $week * 7 * 24 * 60 * 60 );
    $timestamp_for_monday = $timestamp - 86400 * ( date( 'N', $timestamp ) - 1 );
    $date_for_monday = date( 'Y-m-d', $timestamp_for_monday );

[/php]

Best Regards

Can you give us a better example, I’m having a hard time following what you are asking for.

I’m sorry, I do not know english

try to explain this

[b]Week[/b] Thursday

Hour
14

Minute
34

[b]POST

Output:
22 August 2013, 14:34
AND
1377171240[/b]

Thanks
Best Regards

Problem ok,

[php]
$bupazartesi=date(‘d.m.Y’, strtotime(‘noon monday’));
$busali=date(‘d.m.Y’, strtotime(‘noon tuesday’));
$bucarsamba=date(‘d.m.Y’, strtotime(‘noon wednesday’));
$bupersembe=date(‘d.m.Y’, strtotime(‘noon thursday’));
$bucuma=date(‘d.m.Y’, strtotime(‘noon friday’));
$bucumartesi=date(‘d.m.Y’, strtotime(‘noon saturday’));
$bupazar=date(‘d.m.Y’, strtotime(‘noon sunday’))
[/php]

Glad you got it working!

Sponsor our Newsletter | Privacy Policy | Terms of Service