Category Covered

PHP forcely stop a loop  

If you want to stop a loop forcely just use break; to stop for($dayCounter=0; $dayCounter<=21;$dayCounter++){ break; }  
By: social worker  |   Total Read: 907  |   Read more..

how to get a date after 45 days  

If you want a date after some date in php just use the code $start = date('Y-m-d');
$end = date("Y-m-d", strtotime($start ." +45 day") );  
By: Tech writer  |   Total Read: 845  |   Read more..

php function that return the number of days in a month  

Here is a date function that will give output from 28 to 31 which is normally the days on a months. t            
Number of days in the given month 28 through 31 <?php echo date("t");?>  
By: Tech writer  |   Total Read: 917  |   Read more..

How to convert time stamp in 24 hours time  

 Follow the statement to conver timestamp into 24 hours time. $slot = 1377947700; $slot = date('G:i:s', $slot);      
By: Tech writer  |   Total Read: 957  |   Read more..

PHP timestamp into date time  

You can easily convert PHP timestamp into time or date. Ex: $date = 1373879700;
echo date('H:i:s', $date); //outupt : 09:15:00  
By: Tech writer  |   Total Read: 1031  |   Read more..

PHP convert 24 hour time to 12 hour  

Here is an examaple of converting 24 hour time to 12 hour in php.  function twentyfourToTwelve($time) { return date('g:i:s a', strtotime($time . " UTC")); } echo twentyfourToTwelve('15:33:56'); I am sure this will help you to convert 24 hours time to meridian tim.   Convert 12 hour time to 24 hour time  
By: Tech writer  |   Total Read: 1684  |   Read more..

convert 12 hour time to 24 hour time  

If you want to convert 12 hour time or meridian time to 24 hour time in php then follow the instruction For example i have an array like that   [time_to] => Array ( [hour] => 02 [min] => 00 [meridian] => pm ) Use the following code to convert it into 24 hours time. Here i have created a $date object   $date = new DateTime($time_to['hour'] . ':' . $time_to['min'] . ' ' . $time_to['meridian']);  
By: Tech writer  |   Total Read: 1229  |   Read more..

Time slot between two time in php  

I have two time "time from" to "time to". Now i will show how to get a interval time after certain minutes.  Here Timeslot on 15 minutes gap. $from = $sch['time_from']; $to = $sch['time_to']; $timePlus = ''; $i=1; while($timePlus<=$to){ $interval = $sch['time_slots']; $interval = $interval*$i; echo $timePlus = date('H:i:s', strtotime($from.' + '.$interval.' minutes'))."<br/>"; $i  
By: Tech writer  |   Total Read: 1719  |   Read more..

Get all dates of the current month in PHP  

Use the following code to get all the dates on the current month   $todate = date('d'); for($i = $todate; $i<=31; $i++){ $allDates[] = date('Y-m').'-'.$i; $dt = strtotime(date('m/'.$i.'/Y')); $day = date("l", $dt).'-'; } print_r($allDates)  
By: Tech writer  |   Total Read: 848  |   Read more..

List of all day name in a month in PHP  

You can get all the day name on a month in PHP by using the followince PHP code   $from_date = date('d-m-Y'); $to_date = date('d-m-Y', strtotime('+1 month')); $from_date = new DateTime($from_date); $to_date = new DateTime($to_date); for ($date = $from_date; $date <= $to_date; $date->modify('+1 day')) { echo $date->format('l') . "\n"; }  
By: Tech writer  |   Total Read: 796  |   Read more..
Top 15 Posts
Google+