CodePudding user response:
In SQL Server can directly use datediff () function is used in the comparison, it is not necessary to convert it.Such as:
select datediff (d, '2007-11-20', getdate ()) as' is in the sky, datediff (n, 'the 2007-12-6 at 12:05', '2007-12-6 12:07) as' on the minutes more
CodePudding user response:
It can be used on PB:long ll_day, ll_minute
Select top 1 datediff (d, '2007-11-20', getdate ()) as' is in the sky, datediff (n, 'the 2007-12-6 at 12:05', '2007-12-6 12:07) as' on the minutes more into: ll_day, ll_minute from sysobjects;
CodePudding user response:
What do you use the database? , usually there is a corresponding data type conversion functions,Using string or directly in the dw computed columns (x, s) to transform,
CodePudding user response:
After take out the value, direct comparison to go, need not again how convertCodePudding user response:
Unable to accurately compare? This is aIf two time
The 2007-12-06 12...
The 2007-12-06 9...
One is 9 o 'clock in the morning, one is 12 o 'clock, have gap
Both of you use the date a transformation became the 2007-12-06 abandoned her time, what else gap!
It is ok to directly compare
Direct: if date1 & gt; Date2 then... end if
CodePudding user response:
Sample date () function converts a datetime type the date type does not have the timeCodePudding user response:
The topCodePudding user response:
The second floor can explain?CodePudding user response:
The date ldt_1, ldt_2Datetime ldte_1, ldte_2
Ldt_1=date (ldte_1)
Ldt_2=date (ldte_2)
If DaysAfter (ldt_1 ldt_2) & gt; 0 then
Messagebox (ss1, 'ldt_2 date big')
The else
Messagebox (ss2, 'ldt_1 date big')
end if
CodePudding user response:
Welcome everybody if PB high-level programming group,31472550
CodePudding user response:
Haven't met this situation.CodePudding user response:
Have any PB can master to moonlight as a training instructor? If an interested friends, please send resume
To: [email protected], please contact: QQ: 174629429 MSN:[email protected]
CodePudding user response:
Support her Lord, collectionCodePudding user response:
The datetime data type conversion to the date and time respectively in the two types of variables, and then compare.