PHP's commonly used time functions
Test environment: php5.3.29
Unix timestamp (from the Unix era (January 1 1970 00:00:00 GMT) to the number of seconds in a given time. )。 Hereinafter referred to as the time stamp.
Returns a time stamp for a time.
Let's talk about the first look at PHP
date (): format a local time or date, current time May 13, 2016 15:19:49
Using the function date (), the output is currently the day of the month, parameter: string Type D
For example: Echo date ("D");
Grammar
Date (format,timestamp) parameter description
Format required. Specify the format of the timestamp.
Timestamp optional. Specify the time stamp. The default is the current date and time
To find out the day before is time () -60*60*24;
To
For a description of the range of values owned by each type and the valid format for the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using a date function. The following query selects all records and its
The following query selects the records for all date_col values within the last 30 days.
Mysql> SELECT something from Tbl_name
WHERE To_days (now ())-To_days (Date_col) DayOfWeek (date)
Returns the week index of date (1 = Sunday, 2 = Monday, ...). 7
Today on the Internet to see a web connection average time of the shell command, in their own machine tried, found that can not use, incredibly appear awk:fatal:division by zero attempted such a mistake, Mao's own changed the shell command.
The following is a summary of the JS date function encyclopedia, for your reference
1. Get the current time
Copy Code code as follows:
var date=new date ();
2. Date-converted data of the year, month and day known:
Copy
Checkdate:
Verify the correctness of the date.
Date:
Format the time of the server.
Strftime:
The time of the server is formatted locally.
GETDATE:
Get time and date information.
JavaScript time functions
JavaScript provides a Date object for calculations of time and date.
The Date object has several constructors:
New Date ()//Current timeNumber of milliseconds for new Date (milliseconds)//distance start January 1,
Guide:Capital Y represents a four-digit year, while lowercase y represents a two-digit number for the year;Lowercase m represents the number of months (with leading), while lowercase n indicates the number of months without leading.echo Date ('
It is not recommended to use the getyear () function long ago, because it is incorrect to display in Firefox, and it is recommended to use the getFullYear () function.
In addition Firefox does not support innertext this attribute, need to change to
#include
#include
#include
void Main ()
{
printf ("Welcome to the root program with a unary two-time method.") \ n ');
Double a,b,c,dt,sqrtdt,x1,x2;
printf ("Please enter the value of a (the coefficient of the x squared):");
scanf ("%lf",
Large data, algorithm QQ Communication group: 397173819
Do data mining, can not be separated from the use of various time functions.In order to avoid forgetting, as well as follow-up various flying blind everywhere, deliberately summed up the hive
When writing a C-language application, to get or print some time-related information, we often use some time functions that come with the C language, such as times, LocalTime, CTime, Mktime, and Asctime. But you may not notice that there are some
(i) Date and time functions
1.DATE
Purpose: Returns the serial number that represents a specific date.
Syntax: Date (year, month, day)
Parameters: Year, for one to four bits, the parameter is interpreted according to the date system used. By default,
Select Systemdate from dual--get timeSelect systemdate+300 from dual--date + number = date, which represents a date after several daysSelect systemdate-300 from dual--date + number = date, representing the date of the previous several daysSelect
DAYOFWEEK (date)The return date is the day of the week (1= Sunday, 2 = Monday,...... 7= Saturday, ODBC Standard)Mysql> Select DAYOFWEEK (' 1998-02-03 ');3WEEKDAY (date)The return date is the day of the week (0= Monday, 1 = Tuesday,...... 6=
We can often use time in programming, such as getting the system time (to get the system's year, month, day, time, minute, second, week, etc.), or to do something over time, so we use some time functions.
Linux storage time is common in two types
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.