Showing posts with label Facebook. Show all posts
Showing posts with label Facebook. Show all posts

Friday, April 11, 2014

How to Show Timestamp like Seconds and Minutes Ago

Here i am talking about the timestamp which looks like Twitter or Facebook timestamp , 2 Days ago or 4 Days ago or 2 Minutes ago. Same like here is the simple tutorial which will show you how to implement same like this. Once you need to call this function timeAgo($timestamp);and you will just see this stamp one more thing change your timezone according to your taste or server as you wish. Also for the simple way just make your date like "2014-04-11 11:10:20" and take this in $timestamp variable and just call your function you will see these type of timestamp.

function timeAgo($timestamp){
date_default_timezone_set("Asia/Karachi");
    $datetime1=new DateTime("now");
    $datetime2=date_create($timestamp);
    $diff=date_diff($datetime1, $datetime2);
    $timemsg='';
    if($diff->y > 0){
        $timemsg = $diff->y .' year'. ($diff->y > 1?"'s":'');

    }
    else if($diff->m > 0){
     $timemsg = $diff->m . ' month'. ($diff->m > 1?"'s":'');
    }
    else if($diff->d > 0){
     $timemsg = $diff->d .' day'. ($diff->d > 1?"'s":'');
    }
    else if($diff->h > 0){
     $timemsg = $diff->h .' hour'.($diff->h > 1 ? "'s":'');
    }
    else if($diff->i > 0){
     $timemsg = $diff->i .' minute'. ($diff->i > 1?"'s":'');
    }
    else if($diff->s > 0){
     $timemsg = $diff->s .' second'. ($diff->s > 1?"'s":'');
    }

$timemsg = $timemsg.' ago';
echo $timemsg;
}

If you love this tutorials please share it or comment below.

Friday, July 5, 2013

Facebook Fan Page Like Box on Website in Urdu

Class 2 of Web Design:
Creating a Web Page is like a art and you will slowly slowly be expert and your level will be as like a web developer you will gain some knowledge of web design in this class.

What will you Learn ?

  • How to add Facebook like box on webpage.
  • How to Write text in a Web Page.
  • How to Edit your Web Page.
  • How to Save your Web Page.
  • How to make a full Web Page.
This class will guide you through the above content editing, writing, creating, saving.

Video: