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
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
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
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
Share on other sites

you can try using strlen()

 

<?php

$string = "blabla this is not more than 300 characters";
if (strlen($string) > 300) {

echo "The text contains more than 300 characters";

} else {

echo "The text contains less than 300 characters";

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.