Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 699971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:26:44+00:00 2026-05-14T03:26:44+00:00

Hi i am doing internal mail service application , i have the field called

  • 0

Hi i am doing internal mail service application ,

i have the field called datetime in my table,

i want to show the mail datetim in the inbox view somthing like gmail inbox,

i want to show if the mail came just 10 min aga means , i want to show 10min ago,

if mail came around 2 days back means i want to show the DATE-Time ,

Thing keep in mind i maintain the DATETIME datatyoe ,

Thanks
Bharanikumar

This is snippet i have…

list($date, $time) = explode(‘ ‘, $session_time);

list($year, $month, $day) = explode(‘-‘, $date);

list($hour, $minute, $second) = explode(‘:’, $time);

$session_time = mktime($hour, $minute, $second, $month, $day, $year);

$time_difference = time() – $session_time ;

echo $seconds = $time_difference ;

$minutes = round($time_difference / 60 );

$hours = round($time_difference / 3600 );

$days = round($time_difference / 86400 );

$weeks = round($time_difference / 604800 );

$months = round($time_difference / 2419200 );

$years = round($time_difference / 29030400 );

if($days>2){

echo date(“d-m-Y G:i”,$session_time);

}else

// Seconds

if($seconds <= 60)

{

echo “test$seconds seconds ago”;

}

//Minutes

else if($minutes <=60)

{

if($minutes==1)

{

echo “1 minute ago”;

}

else

{

echo "$minutes minutes ago";

}

}

//Hours

else if($hours <=24)

{

if($hours==1)

{

echo “1 hour ago”;

}

else

{

echo “$hours hours ago”;

}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:26:44+00:00Added an answer on May 14, 2026 at 3:26 am

    What you want it what people call Pretty Date. Here is the basic algorithm JavaScript. You should be able to easily port it to PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know the internal working of .net when we doing any thing
I am doing one application in android for that I need to access com.android.internal.telephony
I'm doing some development for some pages on our internal network. I want to
I have a class with internal constructor and want to Resolve it from Unity
I am doing one android application, for that I used com.android.internal API's. They are
I have a page with internal navigation. That means that I show some list
I am interested in knowing about what other teams are doing about limiting internal
OleDbDataAdapter internal error: invalid row set accessor: Ordinal=6 Status=UNSUPPORTEDCONVERSION All I'm doing is trying
Doing my first SL4 MVVM RIA based application and i ran into the following
Doing some jquery animation. I have certain divs set up with an attribute of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.