php type of operations

Time stamp database designed for int format, all require some conversion

1
$lasTtime =time(); //这个是添加一个time时间戳

  The time stamp prints the current time and converted into an int: 1558321414 // this is the time I wrote this timestamp

  When extracted can be used

1
$time = date ( "Y-m-d" , $lastTime ); //date是按你指定格式转换的函数

 

  This timestamp will become: 2019-05-20 11:03:34 // This is the time stamp of the time I wrote this

  If you still want 2019-05-20 11:03:34 format, then converted to int

$ LastTime = strtotime ($ time); // $ time is the variable you want to convert

  Eventually become: 1558321414 // this is the time I wrote this timestamp

 If there is a time difference, using date_default_timezone_set ( "PRC"); get 8 hours jet lag

Copy the code
Copy the code
'H Ymd: I: S' 
// this is a defined time format 
// what needs to take what 
@ s is s, min is the i, h is H, a day d, month is m, is in the Y 
echo DATE ( 'I', $ time_str); 

// to calculate the current time, then do not go into the time-of 
$ 1,313,994,356 = time_str; 
c_time = time () - $ time_str; 
c_time is obtained seconds 
// minutes, then divided by 60 
c_time / 60 with 5 to compare

Guess you like

Origin www.cnblogs.com/mmzz3322/p/10971445.html