MySQL obtains the current date and time stamp function bitsCN.com
MySQL returns the current date, time, and timestamp.
1.1 obtain the current date + time (date + time) function: now ()
Mysql> select now ();
+ ------- +
| Now () |
+ ------- +
| 22:20:46 |
+ ------- +
In addition to the now () function, MySQL also has
Tags: hello BST binary return result SQL function return nbsp HTTP charDB2 left , right functionSyntax: Left (arg,length), right (Arg,length)The left and right functions return the leftmost, rightmost length string of arg, which can be a char or binary string.egSELECT Left (name,2), right (name,2) from T1ORACLE substr () functionSUBSTR (string, intercept start position, intercept length)//return intercepted wordsubstr (' Hello World ', 0, 1)//return r
There are many kinds of functions in the PHP language, different ways of application, and the functions of implementation are not the same. In this paper, we summarize the PHP timestamp function, hoping to be a reference learning object.
Explore PHP dynamic Image creation techniques
PHP get random number Experience
How to use PHP random number class correctly
Explore PHP
1. The PHP timestamp function converts a date to a unix timestamp.Doomsday timestamp PHP The code is as follows: Copy code Echo "doomsday timestamp:". strtotime ("2012-12-21 ") 2. Convert the
:00:00 ')
DATE (' 2002-10-20 ')
DATE (' 10/20/2002 ')
Time (' 12:00:00 ')
Time (' 12.00.00 ')
The TIMESTAMP (), DATE (), and time () functions accept more than one format. The above formats are just examples, and I'll take it as an exercise for readers to discover other formats themselves.
Sometimes, you need to know the difference between two time stamps. To do this, DB2 provides a built-in
Unix_timestamp (time1) > Unix_timestamp (' 2011-03-03 17:39:05 ') and Unix_timestamp (TIME1) Timestamp (' 2011-03-03 17:39:52 ');is to use the Unix_timestamp function to turn the character time into a Unix timestamp. Personally feel that this more practical.
Method Two:
Time1 between ' 2011-03-03 17:39:05 ' and ' 2011-03-03 17:39:52 ';
Method Three:
A
In PHP, the time () function is used to obtain the current UNIX Timestamp. the returned value is from the timestamp epoch (00:00:00 GMT, January 1, January 1, 1970) to the current number of seconds. We have learned the mktime () function before and know that the mktime () function
1. the PHP timestamp function converts a date to a unix timestamp.
Doomsday timestamp PHP
The Code is as follows:
Echo "Doomsday timestamp:". strtotime ("2012-12-21 ")
2. Convert the timestamp
Php date processing function (calculate time difference, convert timestamp date ). The conversion timestamp of the php Tutorial is a commonly used date format and calculation Time difference: the default return type is minute functiontrans_time ($ timestamp) {if ($ timestamp1) echo invalid unix
In PHP, we use the strotime () function to parse the date and time of any English text into UNIX timestamps. Its syntax is as follows: we use
Strotime () functionThe date and time of any English text can be parsed into UNIX timestamps. Its syntax is as follows:
Strotime () function syntax format
strtotime(time,now);
The value is relative to the time given by the parameter now. if the parameter now is not p
One, the PHP timestamp function gets the UNIX timestamp of the specified date Strtotime ("2009-1-22″) example is as follows:
Echo strtotime ("2009-1-22″) Results: 1232553600
Description: Return January 22, 2009 0:0 0 seconds timestamp
Second, the PHP timestamp
you get is null.
Mysql> Select From_unixtime (0);+ ——————— +| From_unixtime (0) |+ ——————— +| 1970-01-01 08:00:00 |+ ——————— +
Mysql> Select From_unixtime (2247483647);+ ————————— +| From_unixtime (2247483647) |+ ————————— +| 2038-01-19 11:14:07 |+ ————————— +1 row in Set (0.00 sec)
4, in addition to MySQL PHP can also achieve the same effect, examples are as follows
(full date and time of the month)Unix timestamp in PHP converted to date
There are many kinds of functions in the PHP language, different ways of application, and the functions of implementation are not the same. In this paper, we summarize the PHP timestamp function, hoping to be a reference learning object.
The PHP timestamp function gets the UNIX ti
In PHP we use the
strotime () functionYou can resolve the date and time of any English text to a Unix timestamp. Its syntax is as follows:
Strotime () function syntax format
Strtotime (Time,now);
Its value is relative to the time given by the parameter now, and if this parameter is not present then the current time of the system is used.
Detailed parameters:
The functi
Use the Mktime () function in PHP to convert a time into a Unix timestamp.
The Mktime () function returns the UNIX timestamp based on the parameters given. The timestamp is a long integer that contains the number of seconds from the Unix era (January 1, 1970) to the given t
1.PHP Timestamp function converts a date to a Unix timestamp
World End Time Stamp PHP
The code is as follows
echo "World Doomsday Timestamp:". Strtotime ("2012-12-21")
2. Convert time stamp to system time
The code is as follows
Date (' y-m-d h:i:s '
PHP gets the start timestamp and end timestamp of today, yesterday, last week, this month, mainly using PHP's time function mktime ().The Mktime function uses the following: Mktime (HOUR,MINUTE,SECOND,MONTH,DAY,YEAR,IS_DST)Parameter descriptionHour is optional. Specified hours.Minute is optional. Specify minutes.Second
PHP Tutorial convert timestamp to commonly used date format with calculated time difference: The default return type is "minutes"
function Trans_time ($timestamp) {
if ($timestamp else return date ("Y-m-d h:i:s", $timestamp);
}
Get IPfunction Get_ip () {if ($_server["http_x
') |+------------------------------------+| 20121212 |+------------------------------------+ 3. Limitations on MySQL Timestamp At present timestamp can be expressed in the range of 1970-2038. The time it takes to get out of this range will overflow is null. Mysql> Select From_unixtime (0);+---------------------+| From_unixtime (0) |+---------------------+| 1970-01-01 08:00:00 |+---------------------+ Mysq
If you simply convert the current time to a timestamp, you can use the new date (). GetTime ()/1000, but if you turn a specific time or date into a Unix timestamp, IE does not support a method with parameters like new date ("2013-1-1") and returns Nan.
For this, I wrote the following functions, support ie6+, Google, Firefox and other browsers:
Copy Code code as follows:
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.