[PHP]Last day of the month/Number of days in the month

Last update on October 24, 2009 06:40 AM by jak58
Published by jak58

Last day of the month and number of days in a month






Using $m as the number of the month i and $y as year. Function date() can display directly the number of days in the month using the "t" character:


<?
      $month = mktime( 0, 0, 0, $m, 1, $y ); 
      setlocal ('LC_ALL', 'en_EN');
      echo "The month ".date("F Y",$mois)." Has
 ".date("t",$mois)." days";
?>



You can have this value back using :

<? $numberofdays = intval(date("t",$mois)); ?>
Best answers for « Last day of the month/Number of days in the month » in :
Download TClockEx Show TclockEx enhances Windows taskbar clock. In addition to the displayed hour, you can add the date with day, month and year or other supplementary information (the size of the available disk, the used memory). TclockEx is totally customizable: you can...
Mktime() - Timestamp yesterday, last month, etc.). ShowMktime() - Timestamp yesterday, last month, etc.) Intro Last 24 hours Yesterday This week Last week This Month Last 30 days (last 30 days) Last month Current year(this year) Last year (last year) Intro The mktime()function...
How to display the last day of the month on your website? ShowHow to display the last day of the month on your website? There is a very easy way to display the last day of the month on your website with a PHP code that you will add in your document. All you have to do is to add “$m” to refer to...
How to change XP Serial/License number ShowHow to change XP Serial/License number Go to / Start Menu/ Run/ Type regedit and click OK. Before any operation in the registry, he should make a backup of the registry as a precaution In the Registry Editor, click File...
Download Random Number Generator Pro ShowRandom Number Generator Pro is a tool that generates a list of random numbers based on customizable criteria. You can choose the minimum and maximum limits and incrementing numbers. Limits can be positive or negative values. Advantage The...
Download Random Number Generator Pro ShowRandom Number Generator Pro is a very simple tool to generate a random number list. There are several combinations and you can define the randomization criteria. You simply select the lower and upper limits as well as the number increments and the...
NAT- Network address translation, port forwarding and port trigg ShowThe principle of NAT Network address translation or NAT was developed in order to respond to the shortage of IP addresses with IPv4 protocol (in time the IPv6 protocol will respond to this problem). In fact, in IPv4 addressing the number of...
Binary encoding ShowIntroduction to binary In the late 1930s, Claude Shannon showed that by using switches which were closed for "true" and open for "false," it was possible to carry out logical operations by assigning the number 1 to "true" and 0 for "false." This...
Representation of real numbers and integers ShowRepresenting a number in a computer Representing (or encoding) a number means to express it in binary form. Representing numbers in a computer is necessary in order for it to be able to store and manipulate them. However, the problem is that a...