This article mainly introduces vue. js converts unix timestamps to custom time formats, which has some reference value. Interested friends can refer to this method through vue. js filter converts unix timestamps to custom Standard Time formats
$ (). Ready (function (){
Vue. filter ('time ',
Function (value) {var date = new Date (value); Y = date. getFullYear (), m = date. getMonth () + 1, d = date. getDate (), H = date. getHours (), I = date. getMinutes (), s = date. getSeconds (); if (m <10) {m = '0' + m;} if (d <10) {d = '0' + d ;} if (H <10) {H = '0' + H;} if (I <10) {I = '0' + I;} if (s <10) {s = '0' + s ;}
// Var t = Y + '-' + m + '-' + d + ''+ H + ':' + I + ':' + s;
Var t = Y + '-' + m + '-' + d; return t ;});)};
{Tab2.fb1 | time }}
In the preceding js code, you can obtain the required standard format.
Note that the input value in this method is a 13-bit unix timestamp. For details about the conversion method, see the js code annotation.
Function (value ){...} Some of them can be extracted separately and used as common js methods.
The above is all the content of this article. I hope it will help you learn and support PHP.
For more information about how to convert a unix timestamp to a custom time format in vue. js, see PHP!