JS Timestamp Turn Date:
function Getymdhms (time) {var date = new Date (parseint (time) * 1000);//Get a Temporal object Note: If the timestamp is Uinx, remember to multiply by 1000. For example, the PHP function time () to get the timestamp will be multiplied by 1000//console.log (Date.getfullyear ());/*----------Below is the method to get the time date, What format do you need to stitch up yourself----------*///date.getfullyear ();//Get the full year (4-bit, 1970)//date.getmonth ();//Get month (0-11, 0 for January, When using, remember to add 1)//date.getdate ();//Get the Day (1-31)//date.gettime ();//Get Time (number of milliseconds starting in 1970.1.1)//date.gethours ();//Get Hours (0-23)/ /date.getminutes ();//Gets the number of minutes (0-59)//date.getseconds ();//Gets the number of seconds (0-59) var date = new Date (timestamp); Get a Time object Note: If the timestamp is Uinx, remember to multiply at 1000. For example, PHP function time () to get the timestamp will be multiplied by 1000Y = date.getfullyear () + '-'; M = (Date.getmonth () +1 < 10? ' 0 ' + (date.getmonth () +1): Date.getmonth () +1) + '-';D = date.getdate () + '; h = (Date.gethours () < 10? ' 0 ' +date.gethours (): Date.gethours ()) + ': '; m = (Date.getminutes () < 10?) ' 0 ' +date.getminutes (): Date.getminutes ()) + ': '; s = (Date.getseconds () < 10? ' 0 ' +date.getseconds (): Date.getseconds ()); return y+m+d+h+m+s;}
JS Date turn timestamp:
Start_date=new Date (current_year+ '-' +current_month+ '-01 00:00:00 ');
End_date=new Date (current_year+ '-' + (parseint (current_month) +1) + '-01 00:00:00 ');
st = Date.parse (start_date)/1000; The time stamp obtained in addition to 1000 can be used to obtain the UNIX timestamp, when the value is passed to PHP.
ET = Date.parse (end_date)/1000;
PHP Date turn timestamp:
$time = $_post["Time"];
$time = Strtotime ($time) -8*3600;
PHP Timestamp Transfer Date:
Date_default_timezone_set (' PRC '); China time Zone
$time =date (' y-m-d h:i:s ', $result [' time ']);
The above describes the JS and PHP timestamp and date conversion, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.