funct Ion DateDiff ($date 1, $date 2, $unit = "") {//Time comparison function, return two dates in seconds, minutes, hours or days
switch ($unit) {
C ASE ' s ':
$dividend = 1;
break;
case ' I ':
$dividend =//osphp.com.cn
break;
case ' h ':
$dividend = 3600;
break;
case ' d ':
$dividend = 86400;
break;//Ope
When you do a project like oa, you may run into a situation that calculates the length of an Employee's seniority, which is not enough to be accurate to the year or to the month, and to share a function that is accurate to how many days. Can be shown in this form similar to 1 years 25 days Apart.
U mode, the spelling of rare words don't worry
Small Series A few days ago received a call "Ma Ming" children's shoes, words sincere, small series of the column made a lot of pertinent suggestions; But the little one wants to say, children's shoes, "your name?" But under, small series had to "Steeds" "a group of horses" play the enthusiastic netizens. Unexpectedly, this troubled small series of problems again by the input method to solve. Small serie
The function can automatically give the number of future days from today on the week sleeve, as follows:
Monday:
Tuesday:
Wednesday:
Thursday:
The following is a reference fragment:Function Getweek (W)' Original: Arisisi' URL: www.alixixi.com' Date: 2009-1-18Dim w1,w2,w3,w4,w5,w6,w7Dim D1,d2,d3,d4,d5,d6,d7D1 = Day (now ())W1 = Weekday (now ())If w1 = W then Getweek = D1D2 = Day (now
#include"stdio.h"#include"stdlib.h"#include"time.h"Main () {inta,b,c,x,d,f=0, g=0; Srand ((unsigned) time (NULL)); A=rand ()% ++1; b=rand ()% ++1; printf ("Please select the addition operation of the title \n1.1-1000 the subtraction operation of the \n2.1-1000 \n3.1-1000 the multiplication operation \n4.1-1000 the division operation \n5. Exit answer \ n"); scanf ("%d",x); System ("CLS"); while(gTen) { if(x==1) {D=a+b; printf ("%d+%d=", A, b); } Else if(x==2) {D=a-b;
SELECT DATEDIFF (year, ' 1986-09-01 ', ' 2016-02-01 ') as Diffdate
DatePart
Abbreviations
Years
YY, yyyy
Quarter
QQ, Q
Month
MM, M
The day of the year
Dy, y
Day
DD, D
Week
WK, WW
Week
DW, W
Hours
hh
Minutes
MI, n
Seconds
SS, S
Milliseconds
Ms
DB2 Create function (a), which describes the use of function content as a field value, or as a where condition.DB2 creates function (ii), which describes the creation of the returned content as a table collection. A call example is shown below?
1
select * fromtable(GET_EFFECTIVE_USER_ID(21))--GET_E
string expression.
SELECT DOUBLE (' 5678 ') from Bsempms;
EXP ()
Returns the exponential function of the parameter.
SELECT EXP (2) from Bsempms;
FLOAT ()
Returns a floating-point representation of a number.
SELECT FLOAT (789) from Bsempms;
Floor ()
Returns the largest integer less than or equal to the parameter.
SELECT Floor (88.93) from Bsempms;
Oracle,sql server, and DB2 should also have its reverse function, because there is a certain application scenario.
CREATE OR REPLACE FUNCTION REVERSE
(
p1 varchar)
RETURNS varchar (m) Specific
"REVERSE"
LANGUAGE SQL
Deterministic
NO EXTERNAL ACTION
reads SQL DATA
BEGIN
declare v_str varchar (m) default ';
DECLARE V_index INTEGER; --Define subs
There are times when we need to index a set of data using letters from A to Z. If the data format is all half-width English is easy to achieve, but if the index of a group of Chinese data will cause a little trouble, data input database may not have specified an index letter, This requires the application to automatically generate information for indexing.
In general, the index of Chinese data uses the first letter of the Chinese pinyin of the phrase, for example:
Phrase Index letter
--- ----
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.