dateform.php

File Type: php File Location: monofiles/ File name: dateform.php
<?php
    
    
    
// format date for use in control panel
    
function date_form($datestr) {


        
$dif time() - (int)$datestr;
        
$day 86400// 1 day
        
        
        
if ($dif $day)
            
$date date('d M Y',$datestr);
        
        
        else {
            
            if (
date('d') != date('d',$datestr))
                
$date date('d M Y',$datestr);
                
                
            else                 
                
$date date('H:i',$datestr);
        }
        
        
        return 
$date;
    
    }
    
    
    
    
// format date for use in website
    
function date_blog($bdate) {
        
        global 
$form;
        
        
$dates = array('none(turn off)',
                       
'off',
                       
'on',
                       
'F d, l, Y',
                       
'd F, Y',
                       
'l, d F, Y',
                       
'D d F, Y',
                       
'd M Y',
                       
'd.m.Y',
                       
'm.d.Y'
                       
);
        

        foreach (
$dates as $fd) {
        
            
            if (
$fd == $form) {
                
                
                if (
$form == 'none(turn off)' || $form == 'off')
                    
$fdate '';
                
                elseif (
$form == 'on')
                    
$fdate date('F d, l, Y',$bdate);
                
                
                else                
                
$fdate date($fd,$bdate);
                
                break;
            }
            
            
        }
        
        return 
$fdate;
        
        
    }
?>