snipt

Ctrl+h for KB shortcuts

Text only

Date Today

1
2
3
    var date = new Date();
    var today = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
    var today_formated = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
https://snipt.net/embed/ad55330d8c79709d50697430965a79a7/
/raw/ad55330d8c79709d50697430965a79a7/
ad55330d8c79709d50697430965a79a7
text
Text only
4
2019-06-17T04:33:30
True
False
False
/api/public/snipt/147414/
date-today
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a> var date = new Date(); </span><span id="L-2"><a name="L-2"></a> var today = date.getFullYear() + &#39;-&#39; + (date.getMonth() + 1) + &#39;-&#39; + date.getDate(); </span><span id="L-3"><a name="L-3"></a> var today_formated = (date.getMonth() + 1) + &#39;/&#39; + date.getDate() + &#39;/&#39; + date.getFullYear(); </span></pre></div> </td></tr></table>
javascript
1
2
3
4
5
6
--- 
+++ 
@@ -1,2 +1,3 @@
     var date = new Date();
     var today = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
+    var today_formated = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
1
2
3
4
5
--- 
+++ 
@@ -0,0 +1,2 @@
+    var date = new Date();
+    var today = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();