Dede Call time

Source: Internet
Author: User
Tags tagname

Time Format Basics

{Dede:field name= ' pubdate ' function= ' strftime ("%y year%M month%d day%h:%m:%s", "@me") '/}2007 year January 1 18:30:02

{Dede:field name= ' pubdate ' function= ' strftime ("%y-%m-%d%h:%m:%s", "@me") '/}2007-1-1 18:30:02

{Dede:field name= ' pubdate ' function= ' strftime (%y year%m month%d%h%m minute%s seconds, "@me") '/}2007 January 1 18:30 02 sec

{Dede:field name= ' pubdate ' function= ' strftime ("%m-%d%h:%m:%s", "@me") '/}1-1 18:30:02

{Dede:field name= ' pubdate ' function= ' strftime ("%m-%d", "@me") '/}1-1

%y-year

%m-Month

%d-Day

%h-hours

%m-min

%s-sec

2. Give the time of the article published within 24 hours to show red.

[Field:pubdate runphp= ' yes ']

$a = "<font color= ' #ff0000 ' >";

$b = "</font>";

$c =strftime ("%y year%M month%d%h:%m:%s", "@me");

$ntime = time ();

$oneday = 3600 * 24;

if ($ntime-@me) < $oneday) @me = $a. $c. $b;

else @me = $c;

[/field:pubdate]

3. Last update time of the article

Last updated: {dede:tagname runphp= ' yes '} @me = Date ("Y-m-d h:i:s", Time ()); {/dede:tagname}

4. If you want to call a few days before the time, to refer to the following time tag code

[Field:pubdate runphp= ' yes ']

$today = Floor (Time ()/(3600 * 24));

$senday = Floor (@me/(3600 * 24));

$updays = $today-$senday;

if ($updays ==0) @me = "Today";

else @me = $updays. " Days ago ";

[/field:pubdate]

Dede Call time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.