Of course, PHP's date function is not possible to directly output Chinese date, but you can use this method to write a function of their own.Code to copy code as followsfunction today () {Date_default_timezone_set ("asia/chongqing");$a =date
This article is reproduced from: http://www.blogjava.net/gf7/archive/2012/07/01/381933.html
function trunc is an Oracle-built function that can be "tailored" to date type data to accommodate different types of data requirements.
In the previous
PHP uses Strtotime to get last month, next month, month's date, Strtotime last month
Write the program today, suddenly found a long time to write a long time to get the number of days of the function, the classic switch version, but to get the
//////by the number of seconds to get the date a few days a few hours ... //////Number of seconds///0: Converted with seconds, 1: No seconds after conversion///a few days, hours, minutes, seconds . Public Static stringParsetimeseconds (intTinttype) {
PHP calculates the difference between two time periods (in seconds, hour, day, month, and year)
Sample Code of the month difference between two time periods:
The Code is as follows:
$ Yourdate = "2012-10-20 ";$
1. Get the current month and day ... Methods of information1 Public classCommondate {2 3 Public FinalString year =string.valueof (Calendar.getinstance (). Get (Calendar.year));4 Public FinalString month = string.valueof
(Only personal, if there is a difference, or not high efficiency also please point out, thank you)Recently in writing a back word app, according to Ebbinghaus curve to review the enhanced memory, need to calculate two review of the difference of
Sample Code of the month difference between two time periods: The code is as follows:Copy code $ Yourdate = "2012-10-20 ";$ Yourdate_unix = strtotime ($ yourdate );Echo (date ("Y", $ yourdate_unix)-date ("Y") * 12 + (date ("m", $ yourdate_unix) -
To the company found that there is a report not received, after viewing the original is an Oracle data source exception. select to_char (sysdate - interval " Span style= "color: #ff0000;" > ' 1 " , yyyymmdd " ) as Fromdata, To_char (sysdate -
Instance code for month difference between two times:
The code is as follows
$yourdate = "2012-10-20";$yourdate _unix=strtotime ($yourdate);Echo (Date ("Y", $yourdate _unix)-date ("Y")) *12+ (date ("M", $yourdate _unix)-
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.