Tuesday, 15 July 2014

CSS Message bog show automatically & hide

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<style type="text/css">
.message{ width: 90%; margin-left:auto; margin-right:auto; position: relative; top: 5px; }
</style>
<?php if(isset($_SESSION["e_msg"]) && $_SESSION["e_msg"]!=""){ ?>
<div class="alert alert-danger alert-error message" style='display:none;'>
   <a href="#" class="close" data-dismiss="alert">×</a>
   <strong>Error!</strong> <?php echo $_SESSION["e_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-danger").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-danger").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['e_msg']);
}
if(isset($_SESSION["i_msg"]) && $_SESSION["i_msg"]!=""){ ?>
<div class="alert alert-info message" style='display:none;'>
   <a href="#" class="close" data-dismiss="alert">×</a>
   <strong>Note!</strong> <?php echo $_SESSION["i_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-info").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-info").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['i_msg']);
}
if(isset($_SESSION["w_msg"]) && $_SESSION["w_msg"]!=""){ ?>
<div class="alert alert-warning warning message " style='display:none;'>
    <a href="#" class="close" data-dismiss="alert">×</a>
    <strong>Warning!</strong>  <?php echo $_SESSION["w_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-warning").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-warning").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['w_msg']);
}
if(isset($_SESSION["s_msg"]) && $_SESSION["s_msg"]!=""){ ?>

<div class="alert alert-success message" style='display:none;'>
   <a href="#" class="close" data-dismiss="alert">×</a>
   <strong>Success!</strong>  <?php echo $_SESSION["s_msg"]; ?>
</div>
<script type='text/javascript'>
$( document ).ready(function() {    $(".alert-success").fadeIn( "slow" );  });
setTimeout(function(){ $(".alert-success").slideToggle( "slow" ); },3000);</script>
<?php
unset($_SESSION['s_msg']);
}
?>

Friday, 11 July 2014

How to calculate no of working days in php?

function getWorkingDays($startDate, $endDate){
   $begin=strtotime($startDate);
   $end=strtotime($endDate);
   if($begin>$end){
     echo "tartdate is in the future! 
"; return 0; }else{ $no_days=0; $weekends=0; while($begin<=$end){ $no_days++; // no of days in the given interval $what_day=date("N",$begin); if($what_day>6) { // 6 and 7 are weekend days $weekends++; }; $begin+=86400; // +1 day }; $working_days=$no_days-$weekends; return $working_days; } }

How to find last day of month in jquery datetime picker?

function getLastDayOfYearAndMonth(year, month){
    return(new Date((new Date(year, month + 1, 1)) - 1)).getDate();
}

Feet/Inches to Meters Converter & Lbs to Kgs Converter

 <!DOCTYPE html> <html lang="en"> <head>   <meta charset="UTF-8" />   <title>Feet/Inches ⇄...