php date

time() //timestamp

echo time();

getdate() //return a array,contain year,month,day....
and you can pass a timestamp to it,return suitable value

getdate();

format:

a am or pm  lowercase

A AM or PM uppercase

d day of month  from 0 

D day of week  Thu(three letter)

F month name 

h hour from 0 (12hour)

H hour from 0 (24hour)

g hour not from 0 (12hour)

G hour not from 0 (24hour)

i minute (0-59)

j day of month not from 0

l (little L) day of week 

m month of  year from 0

M month of year (three letter) Jan

n month of year not from 0

s seconds of hour

U timestamp

y year (two digits)

Y year (four digits)

z day of year  

Z offset in second from GMT



date(format,timestamp);


print date("m/d/Y h:m:s",time());

原文地址:https://www.cnblogs.com/cyany/p/10012626.html