PHP convert seconds to days, hours, and minutes format time simple notation
function Secstostr ($secs) { if ($secs >=86400) {$days =floor ($secs/86400); $secs = $secs%86400; $r = $days. ' Day '; if ($days <>1) {$r. = ' s ';} if ($secs >0) {$r. =
Original: Milliseconds converted to days, hours, minutes, secondsConverts the number of milliseconds or two date types to * days * hours * minutes * seconds, which should be used frequently when calculating time periods. Remember that an ACM problem
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 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
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
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
// Obtain the last day of a month// Method 1: calculate the number of days of the month, and the number of days plus the year + month. The example shows the last day of the month.Private void getlastdateformonth (datetime dtstart, out datetime dtend)
Http://www.cnblogs.com/hxsyl/p/4226483.html
/**
* *
@param number of milliseconds to convert
* @return The number of milliseconds converted to * days * hours * minutes * seconds format
* @author Fy.zhang
* * Public
Recently in the project, you need to turn back the background time into a few seconds ago, a few ago, a few hours ago, a few days ago and other formats; the time format returned in the background is: 2015-07-30 09:36:10, you need to compare the
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.