<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/post//</link>
<title><![CDATA[js 获取服务器时间和new Date()使用方法]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[Web开发]]></category>
<pubDate>Mon, 01 Nov 2021 01:28:09 +0000</pubDate> 
<guid>https://www.heckjj.com/post//</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp; 需求就是到某一个固定的时间就需要一个按钮不显示了，如果试用new Date() 这个获取的是客户端的时间不是服务器时间，客户如果改了本机的时间那这个按钮就没有控制住。找了很多前辈的代码我自己也总结一下，下次使用的时候也方便我查找，也给不知道的小伙伴分享一下。<br/><br/>1.获取服务器时间：<br/><br/>var now = new Date($.ajax(&#123;async: false&#125;).getResponseHeader(&quot;Date&quot;));<br/>2.new Date()用法：<br/><br/>获取年：<br/>var currentYear = now.getFullYear();<br/>获取月：<br/>var currentMonth = now.getMonth();<br/>获取日：<br/>var currentDay = now.getDate();<br/>获取小时：<br/>var currentHours = now.getHours();<br/>获取分钟：<br/>var currentMinutes = now.getMinutes();<br/>获取秒：<br/>var currentSeconds = now.getSeconds();<br/>获取毫秒：<br/>var currentMilliseconds = now.getMilliseconds();<br/>获取当前日期：<br/>var currentDate = now.toLocaleDateString();<br/>获取当前时间：<br/>var currentTime = now.toLocaleTimeString();<br/>获取日期和时间：<br/>var dateTime = now.toLocaleString();<br/>获取当前星期几：<br/>var currentWeek = now.getDay();<br/>获取完成年份：<br/>var currentFullYear = now.getFullYear();<br/><br/>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/post//#blogcomment</link>
<title><![CDATA[[评论] js 获取服务器时间和new Date()使用方法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>