Typecho gets the last update time of the article
in Tutorial with 4 comments
Typecho gets the last update time of the article
in Tutorial with 4 comments

Before introducing the method, let's talk about the content of PHP timestamp and specific time conversion, which is helpful to understand the method I use

Three built-in functions in php

 time() //Get system timestamp mktime(hour,minute,second,month,day,year) //Converts the specified time to a timestamp Date (time format, timestamp) //Convert timestamps into easy to read time

time -> date:

 $now = time(); Echo "Timestamp is"$ now; Echo "Creation date is" date("Y/m/d h:i:s", $now);

Output:
Time stamp is 1458586366
Created on March 22, 2016 2:52:46

mktime -> date:

 $d=mktime(2, 52, 46, 3, 22, 2016); Echo "Timestamp is"$ d; Echo "Creation date is" date("Y/m/d h:i:s", $d);

Output:
Time stamp is 1458586366
Created on March 22, 2016 2:52:46

Typecho Get Article Time

Get the time stamp of the article's publication

 $this->created();

Get the publishing time of the article

 $this->date('F jS , Y \\a\t h:i a');

Output:
March 22nd , 2016 at 02:48 am

Get the updated timestamp of the article

 $this->modified();

Get the update time of the article

 echo date('F jS , Y \\a\t h:i a' , $this->modified);

Output:
March 22nd , 2016 at 02:51 am

That's about it. It took a long time to figure it out.

Responses
  1. This is useful!

    Reply
    1. @Mr. Passer by

      Thank you:)

      Reply
  2. Hallelujah

    Reply
  3. Passing by==~

    Reply