Click here to Skip to main content

Linux, Apache, MySQL, PHP

 
Questionhelp for smtp and ssl Pinmemberb-moumen17-Oct-12 7:53 
Questionhow to get date difference PinmemberMember 915215629-Sep-12 1:13 
AnswerRe: how to get date difference PinmemberPeter_in_278029-Sep-12 2:09 
GeneralRe: how to get date difference PinmemberMember 915215629-Sep-12 2:12 
GeneralRe: how to get date difference PinmemberPeter_in_278029-Sep-12 2:22 
AnswerRe: how to get date difference PinmemberDeepthi.214564-Oct-12 20:11 
AnswerRe: how to get date difference PinmemberAnilannu6-Oct-12 6:30 
AnswerRe: how to get date difference PinmemberMohibur Rashid9-Oct-12 21:25 
If you searched on google you would find 1000's of solutions. this is copied from PHP site
 
<?php
$td = time_diff($timestamp1-$timestamp2); // has to be a positive result
$td .= ($td=="now")? "":" ago"; // in this example "ago"
echo $td;
 
function time_diff($s){
   
    $time = get_post_time('G', true, $post);
    $s = time() - $time;
 
    if($s>=1) {
    $td = "$s sec";
    }  
 
    if($s>59) {
        $m = (int)($s/60);
        $s = $s-($m*60); // sec left over
        $td = "$m min"; if($s>1) $td .="s";
    }
    if($m>59){
        $hr = (int)($m/60);
        $m = $m-($hr*60); // min left over
        $td = "$hr hr"; if($hr>1) $td .= "s";
        if($m>0) $td .= ", $m min";
    }
    if($hr>23){
        $d = (int)($hr/24);
        $hr = $hr-($d*24); // hr left over
        $td = "$d day"; if($d>1) $td .= "s";
        if($d<3){
            if($hr>0) $td .= ", $hr hr"; if($hr>1) $td .= "s";
        }
    }
    return $td;
}
?>
I wish I could believe there is an after life.

QuestionHosting PHP application locally Pinmemberawedaonline20-Sep-12 5:24 
AnswerRe: Hosting PHP application locally PinmemberMohibur Rashid22-Sep-12 3:13 
GeneralRe: Hosting PHP application locally Pinmemberawedaonline23-Sep-12 21:19 
AnswerRe: Hosting PHP application locally Pinmembermaba0018-Oct-12 19:14 
Questionlearn php PinmemberStephan A.18-Sep-12 0:50 
AnswerRe: learn php PinmvpRichard MacCutchan18-Sep-12 1:50 
GeneralRe: learn php [modified] PinmemberStephan A.18-Sep-12 13:46 
GeneralRe: learn php PinmvpRichard MacCutchan18-Sep-12 21:32 
GeneralRe: learn php PinmemberAndrei Straut18-Sep-12 22:29 
GeneralRe: learn php PinmvpRichard MacCutchan18-Sep-12 22:46 
JokeRe: learn php PinmemberAndrei Straut18-Sep-12 22:48 
GeneralRe: learn php PinmvpRichard MacCutchan18-Sep-12 22:53 
GeneralRe: learn php PinmemberStephan A.19-Sep-12 2:40 
GeneralRe: learn php PinmemberRichard A. Abbott19-Sep-12 2:50 
GeneralRe: learn php PinmemberStephan A.19-Sep-12 3:08 
GeneralRe: learn php PinmemberRichard A. Abbott19-Sep-12 3:20 
GeneralRe: learn php PinmvpRichard MacCutchan19-Sep-12 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 9 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid