On the Sina Weibo homepage, you can see that the time displayed after each microblog is not in the standard year-month-day format, but the time difference after conversion, for example: published five minutes ago and two hours ago, similar functions
Js implementation time shows a collection of methods several days ago, several hours ago, or a few minutes ago, js a few days ago
Here we summarize common methods for displaying the js implementation time several days ago, several hours ago, or
On the Sina Weibo homepage, you can see that the time displayed after each microblog is not in the standard year-month-day format, but the time difference after conversion, for example: posted 5 minutes ago and 2 hours ago, it looks more intuitive
Here is a summary of the JS implementation time to display a few days ago, a few hours ago or a few minutes before the common methods. Share to everyone for your reference. Specifically as follows:
Method One:
The personal practice is to save the
To implement similar functions, use JS as follows:
I. javascript function implementation:Instance 1:Copy codeThe Code is as follows:// JavaScript Functions:Var minute = 1000*60;Var hour = minute * 60;Var day = hour * 24;Var halfamonth = day * 15;Var
To achieve similar functions, using JS can be implemented as follows:
One, JavaScript function implementation:Example 1:
Copy Code code as follows:
JavaScript functions:
var minute = 1000 * 60;
var hour = minute * 60;
var day = hour *
on Sina Weibo homepage see the time shown behind each Weibo is not the standard year-month-day format, instead, the time difference between the conversion, such as: Published 5 minutes ago, published in "2 hours ago", compared to the standard
New Document &L t;/title>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Online use of C # Background implementation of the method, for easy to view the paste to the following bar:
This article mainly introduces how javaspt PT is displayed several minutes ago and a few days ago. If you need it, refer to the jsp page:
The Code is as follows:
">
The time is expressed in the form of the double version of PHP and js. Not much nonsense. The PHPFORSmarty copy code is as follows: * Name: time_ago * Purpose: Use the timestamp to express the timestamp in the form of * Second within 1 minute *
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.