找到你要的答案

Q:Show registration date in PHP [closed]

Q:显示[关闭] PHP注册日期

How would I show the registration date of a user? For example, it might say "User since: 3rd April 2015". What PHP code would I need to use to show this?

如何显示用户的注册日期?例如,它可能会说“用户自:2015年4月3日”。什么我需要使用PHP代码将显示这个吗?

answer1: 回答1:

Use date();

$myDate = date("jS M Y");
echo "User since: $myDate";

Output:

User since: 3rd May 2015

Demo:

http://ideone.com/BzzoxP


Explanation:

j Day of the month without leading zeros 1 to 31S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with jM A short textual representation of a month, three letters Jan through DecY A full numeric representation of a year, 4 digits Examples: 1999 or 2003


使用();

$myDate = date("jS M Y");
echo "User since: $myDate";

输出:

User since: 3rd May 2015

演示:

http://ideone.com/bzzoxp


解释:

本月1日没有前导零31s英语序数后缀为日、月2字圣,Nd,RD或TH。工程与JM短一个月三个月的文字表述,通过否认全数字表示的年份,4位数的例子:1999或2003


php