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 8064007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:14:06+00:00 2026-06-05T11:14:06+00:00

For PHP, the function that gives the date of the year. $date = date(‘n/j/Y’,

  • 0

For PHP, the function that gives the date of the year.

   $date = date('n/j/Y', $time);
  echo $date; 

or express as timestamp

   $time = strtotime($date);
   echo $time; 

Basically I want to have my postings list month/day/yr when it’s more than a week old.
and listed as the monday, tuesday …day of the week when the postings are within the week.
And when the posting is within the same day, then express how many hrs ago or how many minutes ago.

Do I need to use timestamp to do subtraction to see the time elapsed? And it does how do I bring it back such a way as what’s time elapsed within the same day or within the same week?

thx

  • 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-06-05T11:14:08+00:00Added an answer on June 5, 2026 at 11:14 am
    $currentTime = time();
    if ($currentTime < strtotime('1 year ago', $currentTime) {
      echo "at least a year old";
    } else if ($currentTime < strtotime('1 month ago', $currentTime) {
      echo "at least a month old (but not a year)";
    } else if ($currentTime < strtotime('1 week ago', $currentTime) {
      echo "at least a week old (but not a month)";
    } else if ($currentTime < strtotime('1 day ago', $currentTime) {
      echo "at least a day old (but not a week)";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP function that requires can take 3 parameteres... I want to
I have a PHP function that I want to make available publically on the
Why is the timestamp generated by the PHP time() function so different from SQL
Is there any function in PHP that either takes a date and turns it
Basically that is the function that I use to extract the date from the
Using the timestamp of PHP's time() function, I show the current time to the
Basically, I am trying to recreate PHP date's year functionality. Using the number of
I have this php function that has to perform some processing on a given
I have a simple PHP function that will grab information from a database based
Is there a php function that someone can use to automatically detect if an

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.