시간의 절취

3532 단어
 1 
 2 "en">
 3 
 4     "UTF-8">
 5     Title
 6 
 7 
 8 
 9 
"tab"> 10 "text" id="inputdate"> 11 12
13 14 <span style="color: #008080;">15</span> window.onload =<span style="color: #000000;"> function () { </span><span style="color: #008080;">16</span> <span style="color: #008000;">/*</span> <span style="color: #008080;">17</span> <span style="color: #008000;"> * Tue Dec 24 2019 12:02:03 </span><span style="color: #008080;">18</span> <span style="color: #008000;"> * </span><span style="color: #008000;">*/</span> <span style="color: #008080;">19</span> <span style="color: #0000ff;">var</span> standardDate = <span style="color: #0000ff;">new</span> Date(<span style="color: #800000;">'</span><span style="color: #800000;">2018,9,1</span><span style="color: #800000;">'</span><span style="color: #000000;">); </span><span style="color: #008080;">20</span> <span style="color: #0000ff;">var</span> year =<span style="color: #000000;"> JSON.stringify(standardDate); </span><span style="color: #008080;">21</span> console.log(year.slice(<span style="color: #800080;">1</span>,<span style="color: #800080;">5</span><span style="color: #000000;">)) </span><span style="color: #008080;">22</span> <span style="color: #0000ff;">var</span> year1 =<span style="color: #000000;"> JSON.stringify(standardDate.getFullYear()); </span><span style="color: #008080;">23</span> <span style="color: #000000;"> console.log(year1) </span><span style="color: #008080;">24</span> <span style="color: #008080;">25</span> <span style="color: #008080;">26</span> <span style="color: #000000;"> }; </span><span style="color: #008080;">27</span> <span style="color: #008080;">28</span> <span style="color: #008080;">29</span> <span style="color: #008080;">30</span> 31 32

좋은 웹페이지 즐겨찾기