Location: PHPKode > projects > WebETB > _include/higher_funcs.php4
<?

function convdate ($VAR)
{
      if (strlen($VAR) != 6 )
      { 
         list ($D, $M, $Y) = split ('[/.-]', $VAR);
      }
      else
      {
         $D=substr($VAR,0,2);
         $M=substr($VAR,2,2);
         $Y=substr($VAR,4,2);
      }     

      if ( $Y <= 100 )
         { $Y=$Y + 1900; }
      if ( $M >= 13 )
         { $M=0;  }
      if ( $D >= 32 )
         { $D=0;  }
      return "$Y-$M-$D";
}

function checkval ($VAR)
{
   if ( $VAR == "NULL" ) 
      { $RETVAR=""; }
   else 
      {  $RETVAR=$VAR; }
   return $RETVAR;
                        
}

function checkdateval ($VAR)
{
   if ( $VAR == "NULL" ) 
   { 
      $RETVAR=""; 
   }
   else 
   {
      list ($Y, $M, $D) = split ('[/.-]', $VAR);
      if ( ($D == "00") || ($M == "00") || ($Y == "0000") )
      {
         $RETVAR="";
      }
      else
      {
         $RETVAR="$D.$M.$Y";
      }

   }
   return $RETVAR;
}

function checktimeval ($VAR)
{
   if ( ($VAR == "NULL") || ($VAR == "00:00:00") ) 
   { 
      $RETVAR=""; 
   }
   else 
   { 
         $RETVAR=$VAR; 
   }
   return $RETVAR;
}


function conv_tactical_date ($VAR)
{
   if ( ( $VAR == "NULL" ) ||  ( $VAR == "" ) )
   { 
      $RETVAR=""; 
   }
   else 
   {
      if (strlen($VAR) == 6 )
      {
         $D=substr($VAR,0,2);
         $M=substr($VAR,2,2);
         $Y=substr($VAR,4,2);
         if ( $Y <= 100 )
            { $Y=$Y + 2000; }
         if ( $M >= 13 )
            { $M=0;  }
         if ( $D >= 32 )
            { $D=0;  }
            $RETVAR="$Y-$M-$D";
      }
      else if (strlen($VAR) == 10 )
      {
         list ($D, $M, $Y) = split ('[/.-]', $VAR);
         $RETVAR="$Y-$M-$D";;
      }
      else
      {
         $RETVAR=date("y-m-d");
      }
   }
   return $RETVAR;
}

function conv_tactical_time ($VAR)
{
   if ( ( $VAR == "NULL" ) ||  ( $VAR == "" ) )
   { 
      return ""; 
   }
   else 
   {
      if (strlen($VAR) == 4 )
      {
         $H=substr($VAR,0,2);
         $i=substr($VAR,2,2);
         $s="30";
         if ( $H <= 9 )
            { $H="0" . $H; }
         if ( $i <= 9 )
            { $i="0" . $i; }
            return "$H:$i:$s";
      }
      else if (strlen($VAR) == 8)
      {
         return $VAR;
      }
      else
      {
         return date("H:i:s");
      }
   }
}
?>
Return current item: WebETB