Own application notes

1, CSS style beyond hidden

Css style multiline text hiding: display: - WebKit box; - WebKit Box Original: vertical; - WebKit line clamp: 2; overflow: hidden;

Css style single line hiding: overflow: hidden; white space: nowrap; text overflow: ellipsis;

2. Pure Css loading style

/*Loading style start*/
.spinner {
    margin: 10px auto 0;
    width: 150px;
    text-align: center;
}

.spinner > div {
    width: 15px;
    height: 15px;
    background-color: #999;
    border-radius: 100%;
    display: inline-block;
    -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
    animation: bouncedelay 1.4s infinite ease-in-out;
    /* Prevent first frame from flickering when animation starts */
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}

.spinner .bounce1 {
    -webkit-animation-delay: -0.32s;
    animation-delay: -0.32s;
}

.spinner .bounce2 {
    -webkit-animation-delay: -0.16s;
    animation-delay: -0.16s;
}

@-webkit-keyframes bouncedelay {
    0%, 80%, 100% {
        -webkit-transform: scale(0.0);
    }

    40% {
        -webkit-transform: scale(1.0);
    }
}

@keyframes bouncedelay {
    0%, 80%, 100% {
        transform: scale(0.0);
        -webkit-transform: scale(0.0);
    }

    40% {
        transform: scale(1.0);
        -webkit-transform: scale(1.0);
    }
}
/*End of loading style*/

  <div class="col-25 spinner" style="text-align: center; display: none;">
        <div class="bounce1"></div>
        <div class="bounce2"></div>
        <div class="bounce3"></div>
 </div>
	



3. Center all pictures regardless of size

.box { 
    width: 160px;
    height: 160px;
    margin: 10px 0 20px;
    overflow: hidden;
    resize: both;
}
.box  img {
    width: 100%;
    height: 100%;
    object-fit: scale-down
}

4. Justify text

Text alignment: width: 4rem; text align last: justify; text align: justify; display: inline block

5. sql date format

Sql Server A very powerful date format function in 
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM 
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06 
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16 
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06 
Select CONVERT(varchar(100), GETDATE(), 4): 16.05.06 
Select CONVERT(varchar(100), GETDATE(), 5): 16-05-06 
Select CONVERT(varchar(100), GETDATE(), 6): 16 05 06 
Select CONVERT(varchar(100), GETDATE(), 7): 05 16, 06 
Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46 
Select CONVERT(varchar(100), GETDATE(), 9): 05 16 2006 10:57:46:827AM 
Select CONVERT(varchar(100), GETDATE(), 10): 05-16-06 
Select CONVERT(varchar(100), GETDATE(), 11): 06/05/16 
Select CONVERT(varchar(100), GETDATE(), 12): 060516 
Select CONVERT(varchar(100), GETDATE(), 13): 16 05 2006 10:57:46:937 
Select CONVERT(varchar(100), GETDATE(), 14): 10:57:46:967 
Select CONVERT(varchar(100), GETDATE(), 20): 2006-05-16 10:57:47 
Select CONVERT(varchar(100), GETDATE(), 21): 2006-05-16 10:57:47.157 
Select CONVERT(varchar(100), GETDATE(), 22): 05/16/06 10:57:47 AM 
Select CONVERT(varchar(100), GETDATE(), 23): 2006-05-16 
Select CONVERT(varchar(100), GETDATE(), 24): 10:57:47 
Select CONVERT(varchar(100), GETDATE(), 25): 2006-05-16 10:57:47.250 
Select CONVERT(varchar(100), GETDATE(), 100): 05 16 2006 10:57AM 
Select CONVERT(varchar(100), GETDATE(), 101): 05/16/2006 
Select CONVERT(varchar(100), GETDATE(), 102): 2006.05.16 
Select CONVERT(varchar(100), GETDATE(), 103): 16/05/2006 
Select CONVERT(varchar(100), GETDATE(), 104): 16.05.2006 
Select CONVERT(varchar(100), GETDATE(), 105): 16-05-2006 
Select CONVERT(varchar(100), GETDATE(), 106): 16 05 2006 
Select CONVERT(varchar(100), GETDATE(), 107): 05 16, 2006 
Select CONVERT(varchar(100), GETDATE(), 108): 10:57:49 
Select CONVERT(varchar(100), GETDATE(), 109): 05 16 2006 10:57:49:437AM 
Select CONVERT(varchar(100), GETDATE(), 110): 05-16-2006 
Select CONVERT(varchar(100), GETDATE(), 111): 2006/05/16 
Select CONVERT(varchar(100), GETDATE(), 112): 20060516 
Select CONVERT(varchar(100), GETDATE(), 113): 16 05 2006 10:57:49:513 
Select CONVERT(varchar(100), GETDATE(), 114): 10:57:49:547 
Select CONVERT(varchar(100), GETDATE(), 120): 2006-05-16 10:57:49 
Select CONVERT(varchar(100), GETDATE(), 121): 2006-05-16 10:57:49.700 
Select CONVERT(varchar(100), GETDATE(), 126): 2006-05-16T10:57:49.827 
Select CONVERT(varchar(100), GETDATE(), 130): 18 ???? ?????? 1427 10:57:49:907AM 
Select CONVERT(varchar(100), GETDATE(), 131): 18/04/1427 10:57:49:920AM 


//Frequently used: 
Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46 
Select CONVERT(varchar(100), GETDATE(), 24): 10:57:47 
Select CONVERT(varchar(100), GETDATE(), 108): 10:57:49 
Select CONVERT(varchar(100), GETDATE(), 12): 060516 
Select CONVERT(varchar(100), GETDATE(), 23): 2006-05-16 




C  Currency 2.5.ToString("C")  ¥2.50
D
//Decimal number
25.ToString("D5")
00025
E
//Scientific type
25000.ToString("E")
2.500000E+005
F
//Fixed point
25.ToString("F2")
25.00
G
//routine
2.5.ToString("G")
2.5
N
//number
2500000.ToString("N")
2,500,000.00
X
//Hexadecimal
255.ToString("X")
FF

6. How long to query data in sql

All today's data: select * from table name where DateDiff(dd,datetime type field, getdate())=0
 All yesterday's data: select * from table name where DateDiff(dd,datetime type field, getdate())=1
 All data within 7 days: select * from table name where DateDiff(dd,datetime type field, getdate()) < 7
 All data within 30 days: select * from table name where DateDiff(dd,datetime type field, getdate()) < 30
 All data of this month: select * from table name where DateDiff(mm,datetime type field, getdate())=0
 All data of this year: select * from table name where DateDiff(yy,datetime type field, getdate())=0

 

Published 25 original articles, won praise 7, visited 20000+
Private letter follow

Tags: SQL

Posted on Tue, 17 Mar 2020 08:03:44 -0700 by legio