QNimate

  • CoursesVideos
  • WP PremiumPlugins
  • DemosLab
  • Bitcoin BankingBuy, Sell, Store and Earn Interest
  • Home
  • QIdea
  • QTrack
Home Carbon Ads Get WordPress Post Date as Current Time Difference

Get WordPress Post Date as Current Time Difference

In this tutorial I will show you how to get WordPress post published date as time difference i.e., 2 days ago, 5 months ago etc.

Here is the code to get in this format

<?php

$time = get_post_time("U", true, $post_id);
$time = human_time_diff($time, current_time('timestamp')) . " ago";

echo $time;
Mar 7, 2015Narayan Prusty
Create a Intel XDK APP with PHP and MySQL BackendCreate a Chat App using Intel XDK and XMPP
Comments: 1
  1. Nitai Kshatriya
    4 years ago

    If you’re here, you’re all set, pardner!

    ReplyCancel

Leave a Reply Cancel reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

Narayan Prusty

I am a full-stack web developer. I specialize in Blockchain and JavaScript. This is my personal blog where I write about programming and technologies that I learn and feel interesting to share.

6 years ago 1 Comment WordPress
Share this
0
GooglePlus
0
Facebook
0
Twitter
0
Linkedin
Related Articles
  • Get Excerpt in WordPress
  • WordPress Enable Automatic Theme Updates
  • WordPress Enable Automatic Plugin Updates
  • WordPress Custom Meta Boxes Tutorial
  • AJAX In WordPress
Our Sponsor
Freelance: I am available
@narayanprusty
Hi, I am a full-stack developer - focusing on JavaScript, WordPress, Blockchain, DevOps, Serverless and Cordova. You can outsource your app development to me.





Will get back to you soon!!!
WordPress
ReactJS
Meteor
Blockchain
Serverless
Kubernetes
DevOps
DB & Storage
Ejabberd
Let's get started
My Books

2014 - 2015 © QNimate
All tutorials MIT license