2 SET @dt = GETDATE ();
3 DECLARE @table table (caption varchar ( 20 ),value datetime );
4
5 INSERT INTO @table VALUES ( ' 0 ' , @dt );
6 INSERT INTO @table VALUES ( ' -1 ' , @dt - 1 );
7 INSERT INTO @table VALUES ( ' -0.1 ' , @dt - 0.1 );
8 INSERT INTO @table VALUES ( ' -0.01 ' , @dt - 0.01 );
9 INSERT INTO @table VALUES ( ' -0.001 ' , @dt - 0.001 );
10 INSERT INTO @table VALUES ( ' -0.0001 ' , @dt - 0.0001 );
11 INSERT INTO @table VALUES ( ' -0.00001 ' , @dt - 0.00001 );
12 INSERT INTO @table VALUES ( ' -0.000001 ' , @dt - 0.000001 );
13 INSERT INTO @table VALUES ( ' -0.0000001 ' , @dt - 0.0000001 );
14
15 SELECT * FROM @table
16
show result:
caption value
0 2010-05-05 18:50:03.547
-1 2010-05-04 18:50:03.547
-0.1 2010-05-05 16:26:03.547
-0.01 2010-05-05 18:35:39.547
-0.001 2010-05-05 18:48:37.147
-0.0001 2010-05-05 18:49:54.907
-0.00001 2010-05-05 18:50:02.683
-0.000001 2010-05-05 18:50:03.463
-0.0000001 2010-05-05 18:50:03.540
So, in the end it is how he calculated. People immediately see a little focus, when -1, the date just minus one day so we can understand:
-1 = date minus one day.
Then the next, only you need to convert it to understand.
Date = today's date minus -0.1 0.1 Tian .
0.1 days, then 0.1 days is how much? Suddenly awakened, it turned out to be in accordance with the minutes of addition and subtraction.
1 day equals 60 minutes multiplied by 24 hours
Equal to 0.1 multiplied by 24 hours 60 minutes, and then multiplied by 0.1.
Such a right, this really is!
Reproduced in: https: //www.cnblogs.com/sofire/archive/2010/05/05/1728323.html