It's very complicated to find it on the Internet , This is a rough indication of the popular time , I feel dizzy around

```function timeAgo(o){
var n=new Date().getTime();
var f=n-o;
var bs=(f>=0?' front ':' after ');// Judge that the time point is at the current time Before still after
f=Math.abs(f);
if(f<6e4){return ' just '}// Less than 60 second , just
if(f<36e5){return parseInt(f/6e4)+' minute '+bs}// Less than 1 Hours , By the minute
if(f<864e5){return parseInt(f/36e5)+' Hours '+bs}// Less than 1 Day by hour
if(f<2592e6){return parseInt(f/864e5)+' God '+bs}// Less than 1 Months (30 God ), By days
if(f<31536e6){return parseInt(f/2592e6)+' Months '+bs}// Less than 1 year (365 God ), By month
return parseInt(f/31536e6)+' year '+bs;// Greater than 365 God , On an annual basis
}
// call , The parameter is timestamp
timeAgo(1512383560443);```

## js Publication time of calculation ... minute / Hours ago / More related articles in the future

1. js Calculate the time difference （ God , Hours , minute , second ）

<script type="text/javascript"> var date1= '2015/05/01 00:00:00'; // Starting time var date2 = ...

2. Js Calculate the time difference （ God 、 Hours 、 minute 、 second ）

<script type="text/javascript"> var date1= '2015/05/01 00:00:00'; // Starting time var date2 = ...

3. js Calculate the interval between two times

There are many ways to calculate time intervals , It's just a way , You can pass in two times directly in the method , You can also pass in two time strings , If you parse it in the method, you can ok, In this case, no parameters are passed in , Just write a random time in the method to demonstrate fun() ...

4. JS Calculate the time difference from the current time

/** * JS Get the time difference from the current * * @param int time JS Millisecond time stamp * */ function get_time_diff(time) { var diff = ''; var ...

5. use js Calculate the weekly selection from start to end time

The front desk chooses the day of the week ( Monday, Sunday ), Such as choice <td> Monday </td>,<td> Wednesday </td>,<td> Friday </td> I use js attr to t ...

6. js Calculate the number of days between two times

// The number of days between the two times compatible firefox chrome    function datedifference(sDate1, sDate2) {    //sDate1 and sDate2 yes 2006-12 ...

7. js Calculate the difference between the two times

.filter('useTime', function() { return function(val) { // if (/.(.mp4)\$/gi.test(url)) { // return JS ...

8. Use C# Change the time of publication to a few months , A few days ago , A few hours ago , A few minutes ago , Or a few seconds ago

// Use C# Change the time of publication to a few months , A few days ago , A few hours ago , A few minutes ago , Or a few seconds ago //2008 year 03 month 15 Japan Saturday 02:35 public string DateStringFromNow(DateTim ...

9. It's more difficult to appear in the forum sql problem ：45( Hours of user online login time 、 The minute calculation problem )

original text : It's more difficult to appear in the forum sql problem :45( Hours of user online login time . The minute calculation problem ) lately , In the Forum , I've met a lot of difficult ones sql problem , Even though I can solve it myself , But a few days later , I can't remember , I forgot the solution . ...

## Random recommendation

1. YprogressBar,html5 Progress bar style ,js Progress bar plug-in

brief introduction YprogressBar It's based on HTML5 Progress bar plug-in for . YprogressBar Is a lightweight progress bar plug-in , Easy to use , Less resources , Imitate a good decompression interface , With digital display , At the same time, it supports adding parameters in the description , To move ...

2. 01-C Language Overview

Contents of this article One .C A brief history of language Two .C Characteristics of language 3、 ... and .C What can language do ? Four .C The version of the language 5、 ... and .C Language grammar preview Back to the top One .C A brief history of language C Language in 1972 The invention of , First used to rewrite UINX operating system (UNI ...

3. [Python] How to read and write files

4. Android Use in shape Realization EditText Round corners

I saw Baidu on my mobile phone before editText Control is rounded, so I tried to do it , Read the related articles . Because there's less code , Just look at it . So I'll stick the code directly for your reference , There are other good ways to remember to share ~ The whole code doesn't involve JAVA Code ...

5. CodeSmith Use summary -- Create a basic template

ask : Why use CodeSmith? answer : Because I'm lazy to write . Codesmith It's a very good tool for lazy people , I also use it a lot , Because it is in “ Duplicate code ” It can save us a lot of time , And get rid of the tedious and tedious “ code ...

6. yii Basic knowledge of - application

Application refers to the execution context in request processing . Its main task is to analyze user requests and dispatch them to the appropriate controller for further processing . It also serves as a service center , Maintain application level configuration . In view of this , Applications are also called front-end controllers . Application by   Entry script   Create as a ...

7. dp State compression - Brick laying

subject : There is one n That's ok m The floor of the column , Need to use 1*2 Small brick blanket , Small bricks cannot overlap each other , How many different paving methods are there ? demonstration : solution : use F[i][j] Depositing the first place i OK, No j state (j It's decimal , Turning to binary is the State ) How many options are there . use ...

8. Quick sort -python

9. leveldb Source code analysis -- journal

We know that in a database system, in order to ensure the reliability of data , We all record the operation log of the system . The function of log is to use in the system down Restore the data when it is dropped , So the log system is very important for a storage system that requires reliability . Next we will analyze ...

10. Java Introduction to the working principle of virtual machine

1. Java File execution process 2.  Operation data area Runtime Data Areas: When running a JVM Example time , The system will assign it a memory area ( The size of this memory area can be set ), This memory area is made up of JVM It's up to you ...