1、 Filter 13 A time stamp ( Take comment time for example )

 filters : {
formattime2: function (value) {
//value by 13 Bit time stamp
var timestamp = Date.parse(new Date());
var ms = Math.abs(timestamp - value);
var second = parseInt(ms / 1000);
var minute = parseInt(ms / 1000 / 60);
var iHour = parseInt(ms / 1000 / 60 / 60);
var day = parseInt(ms / 1000 / 60 / 60 / 24);
if(second < 1){
return " just ";
}else if(minute < 60){
return minute+" Minutes ago ";
}else if(iHour < 24){
return iHour+" Hours before ";
}else{
return day+" Days ago, ";
}
}
},

vue More articles on time filtering

  1. js Time filtering method

    js Time to filter   His writing   Make a note of /** * * Filter time format * Created by Catlina at 2019.4.26 */ export const setTime = time = ...

  2. vue Time selector components

    vue Time selector components Component effect : Single file component : <template> <div class="date-pickers"> <!--date by com ...

  3. VUE Use of filters vue Time format

    Filter introduction Official course address :https://cn.vuejs.org/v2/guide/filters.html Filters are often used for some text formatting We can customize the filter , Can achieve a variety of functions . vue Time ...

  4. Vue The use of time modifiers $event and prevent Modifier operation form

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. Vue Use of global filters It's used in time filtering Add content crud

    Use of filters msgFormt It's your own filter method , Vue.filter It's your own global filter . No, s The filter should have a return value use retuen     Vue.filter("msgFo ...

  6. Yes angularjs Time filter format

    In a recent project , I have a little problem like this , A time value came from the background , The format is as follows : "/Date(1484743002000)/" As for why this format , The development of the background says that this is stored in the database ( ...

  7. Linux Find time filtered files in the directory

    In maintenance projects , Sometimes some conditions are specified to filter the file , And operate the batch of files : Now we're going to use shell Command to operate : Go straight to the code #!/bin/sh #BEGIN #`find ./ ! -name " ...

  8. Vue Global filtering and local filtering

    Local filter ( Put it in a component ) filters: { // Local filter FormattingMoney:value=>{ return value==null? '0' : value/100 } }, ...

  9. PowerBI Development Chapter 15 :DAX expression ( Time + Filter + Relationship )

    DAX The expression contains time relations (Time Intelligence) Related functions , Used to accumulate date dimensions . Year on year and month on month analysis .PowerBI Be able to create relationships , Filter the context that affects the calculation . One , Time relation DAX ...

Random recommendation

  1. VS2013 Add an existing folder

    1. Copy an existing project or folder to the specified directory 2. There's a button on the top right of the solution to show all the files Then select all the files you want to add , Right click

  2. C# Excel Import

    Two tables are imported into one DataGrid Inside ( Question list and answer list ) The front desk code <asp:Content ID="Content1" ContentPlaceHolderID=" ...

  3. ZOJ-3870 Team Formation

    The main idea of the topic : to n It's a positive number , Find satisfaction A^B>max(A,B) The logarithmic . Topic analysis : The code is as follows : # include<iostream> # include<cstdio> # i ...

  4. X64 Under the system IIS function ASP Website HTTP500 error 【 install FoxMail Server When 】

    The error is as above terms of settlement Run in administrator mode CMD Input cscript C:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitA ...

  5. One click helps you copy multiple files to multiple machines ——PowerShell Little script ( Enclosed PS Remote execution command problem analysis )

    As a background program , It's often necessary to put a bunch of assemblies (DLL) Or the app (EXE) Copy to multiple servers , Realize the code logic update of the program , To test new functions or change logic . Here's a self implemented PowerShell Script , Fang ...

  6. About the IntellIj IDEA in JSP page cannot resolve method getParameter(&quot;&quot;) Solutions for

    File->Project Structure->Libraries, Then click the plus sign , take Tomcat lib Under folder servlet.jar and servlet-api.jar Package import .

  7. Redis Cluster tutorial (Redis cluster tutorial)

    This blog post is translated from Redis Official website :http://redis.io/topics/cluster-tutorial         This document introduces... In a gentle way Redis colony , Don't use complex ways to understand the concept of Distributed Systems . ...

  8. solve Android At compile time aapt.exe finished with non-zero exit value 1

    When this error occurs , It shows that there is an error in your resource file . However AS There's too little information to give you , I haven't seen why for a long time , It doesn't say which resource file is wrong , I don't know . It can be used at this time Gradlew To debug . and grad ...

  9. The third chapter start-up rabbitmq Of webUI

    One . Start step 1. start-up rabbitmq rabbitmq-server ( The front desk starts ) perhaps rabbitmq-server -detached( Background start ) 2. start-up rabbitmq_management ...

  10. JDBC Return primary key

    Reprinted to :https://www.liyongzhen.com/ Last class we learned to pass PreparedStatement Object to perform a query with parameters SQL And modify SQL. In this lesson we learn to use PreparedS ...