Hello,
I've got a script of facebook date but I want to translate the returning day into my language (Monday=>mmday for instance). Could you guy please.

function fb_date($timestamp){  
    $difference = time() - $timestamp;  
    $periods = array("second", "minute", "hour");  
    $ending=" ago";  
    if($difference<60){  
        $j=0;  
        $periods[$j].=($difference != 1)?"s":"";  
        $difference=($difference==3 || $difference==4)?"a few ":$difference;  
        $text = "$difference $periods[$j] $ending";  
    }elseif($difference<3600){  
        $j=1;  
        $difference=round($difference/60);  
        $periods[$j].=($difference != 1)?"s":"";  
        $difference=($difference==3 || $difference==4)?"a few ":$difference;  
        $text = "$difference $periods[$j] $ending";       
    }elseif($difference<86400){  
        $j=2;  
        $difference=round($difference/3600);  
        $periods[$j].=($difference != 1)?"s":"";  
        $difference=($difference != 1)?$difference:"about an ";  
        $text = "$difference $periods[$j] $ending";       
    }elseif($difference<172800){  
        $difference=round($difference/86400);  
        $periods[$j].=($difference != 1)?"s":"";  
        $text = "Yesterday at ".date("g:ia",$timestamp);                                  
    }else{  
        if($timestamp<strtotime(date("Y-01-01 00:00:00"))){  
            $text = date("l j, Y",$timestamp)." at ".date("g:ia",$timestamp);         
        }else{  
            $text = date("l j",$timestamp)." at ".date("g:ia",$timestamp);            
        }  
    }  
    return $text;  
}

someone help?

Member Avatar for diafol

If fb not available in your lang. Create an array:

$days = array('Sunday'=>'Sul','Monday'=>'Llun',...);

Get the dayname from the string and do a str_replace(). There are loads of ways you can do this - many date functions. Take your pick.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.