date_functions.php

<?php

//================================================================================


/*
              reformat_dt($arrival_date){

 Formats a MySQL date of "YYYY-MM-DD" to a user friendly
 format such as  "May-06-2007"

*/

function reformat_dt($dat){
 
// CONVERT ARRIVAL DATE TO MORE USER FRIENDLY FORMAT
                       
$dat strtotime($dat);
                     return   
date('M-d-Y'$dat);
  
}


function 
reformat_dt_tim($dat){
 
// CONVERT DATE TIME TO MORE USER FRIENDLY FORMAT
                       
$dat strtotime($dat);
                     return   
date('M-d-Y H:i'$dat);
  
}


//===========================================================================================



/*
               return_month($month)

 Returns the numeric values for a three letter month for database use


*/


function return_month($month){
         switch(
$month){
            case 
"Jan": return "01"; break;
            case 
"Feb": return "02"; break;
            case 
"Mar": return "03"; break;
            case 
"Apr": return "04"; break;
            case 
"May": return "05"; break;
            case 
"Jun": return "06"; break;
            case 
"Jul": return "07"; break;
            case 
"Aug": return "08"; break;
            case 
"Sep": return "09"; break;
            case 
"Oct": return "10"; break;
            case 
"Nov": return "11"; break;
            case 
"Dec": return "12"; break;
         }
}


//==========================================================================================


/*  convert_mysql_date_to_julian($mysql_date)


 Converts a date of format YYYY-MM-DD to julian day count


*/

function convert_mysql_date_to_julian($mysql_date){


            
$date_array explode("-",$mysql_date);

            return 
gregoriantojd($date_array[1],$date_array[2],$date_array[0]);


}

//==========================================================================================

?>

Paul's Code Library

Categories

Home

AJAX

classes

database_functions

date_functions

file_functions

googlevideo_and_youtube_api

htaccess

image_functions

string_functions