Jump to content

Doubt


leela

Recommended Posts

Hello,

 

I got the foll O/P:

 

Apr

Dec

Nov

 

Nov Dec Apr

Array ( [Jan] => 01-31 [Feb] => 01-28 [Mar] => 01-31 [Apr] => 01-30 [May] => 01-31 [Jun] => 01-30 [Jul] => 01-31 [Aug] => 01-31 [sep] => 01-30 [Oct] => 01-31 [Nov] => 01-30 [Dec] => 01-31 )

 

I wrote the same code.Plz recheck the code and send me.

 

Thanks,

leela

Link to comment
https://forums.phpfreaks.com/topic/48667-doubt/
Share on other sites

not sure what your talking about...

 

from what i see... your looking to find how many days are in each month...? this way is far easier...

 

<?
function get_daysinmonth($month, $year){
if(checkdate($month, 31, $year)) return 31;
elseif(checkdate($month, 30, $year)) return 30;
elseif(checkdate($month, 29, $year)) return 29;
elseif(checkdate($month, 28, $year)) return 28;
return FALSE;
}

for($i=1; $i<=12; $i++){
$months[$i]=get_daysinmonth($i,date(Y));
}
?>

Link to comment
https://forums.phpfreaks.com/topic/48667-doubt/#findComment-238390
Share on other sites

<?php

// get array of months information

$months = array("Jan"  => "01-31",

"Feb"  => "01-28",

"Mar"  => "01-31",

"Apr"  => "01-30",

"May"  => "01-31",

"Jun"  => "01-30",

"Jul"  => "01-31",

"Aug"  => "01-31",

"Sep"  => "01-30",

"Oct"  => "01-31",

"Nov"  => "01-30",

"Dec"  => "01-31");

// get months

$thismonth      = date('y'-'m'-'d');

$lastmonth      = date('y-m-d')-mktime(0,0,0,date('y')-0,date('m')-1,date('d')-0);

echo $lastmonth  = date("M", $lastmonth);

echo "<br>";

$monthbeforelast = strtotime("-2 month", $thismonth);

echo $monthbeforelast;

// turn them into the proper format

$thismonth = date("M");

$lastmonth  = date("M", $lastmonth);

$monthbeforelast = date("M", $monthbeforelast);

echo $thismonth;

echo "<br />";

//echo $lastmonth;

echo "<br />";

echo $monthbeforelast;

echo "<br />";

?>

 

<form name="dates" id="dates" action="" method="post">

<select name="months">

<option value="<?php echo $monthbeforelast; ?>"><?php echo $monthbeforelast . $months['$monthbeforelast']; ?></option>

<option value="<?php echo $lastmonth; ?>"><?php echo $lastmonth . $months['$lastmonth']; ?></option>

<option value="<?php echo $thismonth; ?>"><?php echo $thismonth . $months['$thismonth']; ?></option>

</select>

</form>

<?php

print_r($months);

?>

 

 

i got the above o/p for this question.

i require last 3 months .

Link to comment
https://forums.phpfreaks.com/topic/48667-doubt/#findComment-238394
Share on other sites

  • 2 weeks later...

 

 

Hello EveryOne,

 

            I Want to count the characters in text area and limit that count to minimum of 300 characters( actually , this count  shud be set by admin in database ) . if the characters are less than 300 , alert message shud come.focus should return to text area.  Plz any body help me.I am in need of this.

 

Thanks,

Leela

                         

Link to comment
https://forums.phpfreaks.com/topic/48667-doubt/#findComment-246207
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.