snipt

Ctrl+h for KB shortcuts

PHP

PHP - Copyright with automatic year

// http://www.w3schools.com/php/php_date.asp
&copy; 2010-<?php echo date("Y");?>
https://snipt.net/embed/52b0484218e23e721f9ed8e9bb9f0293/
https://snipt.net/raw/52b0484218e23e721f9ed8e9bb9f0293/
52b0484218e23e721f9ed8e9bb9f0293
php
PHP
2
2016-09-21T10:26:18
True
False
False
/api/public/snipt/147491/
copyright-with-automatic-year
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="x">// http://www.w3schools.com/php/php_date.asp</span> </span><span id="L-2"><a name="L-2"></a><span class="x">&amp;copy; 2010-</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">date</span><span class="p">(</span><span class="s2">&quot;Y&quot;</span><span class="p">);</span><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
Copyright, Date, PHP

Text only

HTTP-Date (HTTP/1.1 RFC-2616) regular expression validation (RFC-1123/RFC-850/ANSI C asctime)

(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-2][0-9]|3[01]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:[0-2][0-9]|3[01])-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[ 1-2][0-9]|3[01]) (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] \d{4})
https://snipt.net/embed/34a920c3bd75951b7aa4aff6c40a9f28/
https://snipt.net/raw/34a920c3bd75951b7aa4aff6c40a9f28/
34a920c3bd75951b7aa4aff6c40a9f28
text
Text only
1
2016-09-26T18:02:51
True
False
False
Apr 03, 2015 at 04:33 PM
/api/public/snipt/138884/
http-date-regular-expression-validation-rfc-1123rfc-850asctime-f64e6aa3
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-2][0-9]|3[01]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:[0-2][0-9]|3[01])-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[ 1-2][0-9]|3[01]) (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] \d{4}) </span></pre></div> </td></tr></table>
"ANSI C", "RFC 1123", "RFC 2616", "RFC 850", 1123, 2616, 850, Date, HTTP, HTTP-Date, HTTP/1.1, RFC, asctime, expression, format, regular, validation

Text only

RFC 1123 regular expression validation

(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-2][0-9]|3[01]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] GMT
https://snipt.net/embed/eecad054c520ad40fa0ebef8843e2f90/
https://snipt.net/raw/eecad054c520ad40fa0ebef8843e2f90/
eecad054c520ad40fa0ebef8843e2f90
text
Text only
1
2016-09-26T18:02:56
True
False
False
/api/public/snipt/138883/
rfc-1123-regular-expression-validation-f4262fe2
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-2][0-9]|3[01]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} (?:[01][0-9]|2[0-3]):[012345][0-9]:[012345][0-9] GMT </span></pre></div> </td></tr></table>
"RFC 1123", 1123, Date, RFC, expression, regular, validation

JavaScript

JS Date formatter

1
2
3
4
5
6
7
/*
 * Función formateadora de fechas.
 */
function dateFormatter(dateAsLong) {
	var date = new Date(dateAsLong);
	return date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes();
}
https://snipt.net/embed/878440b0b9c96f05a6fad01f29bf24cf/
https://snipt.net/raw/878440b0b9c96f05a6fad01f29bf24cf/
878440b0b9c96f05a6fad01f29bf24cf
js
JavaScript
7
2016-09-22T01:00:08
True
False
False
May 05, 2014 at 05:38 AM
/api/public/snipt/134736/
js-date-formatter-9e1198a7
<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> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cm">/*</span> </span><span id="L-2"><a name="L-2"></a><span class="cm"> * Función formateadora de fechas.</span> </span><span id="L-3"><a name="L-3"></a><span class="cm"> */</span> </span><span id="L-4"><a name="L-4"></a><span class="kd">function</span> <span class="nx">dateFormatter</span><span class="p">(</span><span class="nx">dateAsLong</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="kd">var</span> <span class="nx">date</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nx">dateAsLong</span><span class="p">);</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">return</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getDate</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;/&quot;</span> <span class="o">+</span> <span class="p">(</span><span class="nx">date</span><span class="p">.</span><span class="nx">getMonth</span><span class="p">()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;/&quot;</span> <span class="o">+</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getHours</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;:&quot;</span> <span class="o">+</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getMinutes</span><span class="p">();</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
Date, JS, format

PHP

PHP Date triggered events

1
2
3
4
5
6
<?
$time_passed = (time() > strtotime('2014-01-18 00:00:00'));
    
    if ($time_passed) {
        // Do something
    } ?>
https://snipt.net/embed/8025a38e4bb59287149635f0207a45b6/
https://snipt.net/raw/8025a38e4bb59287149635f0207a45b6/
8025a38e4bb59287149635f0207a45b6
php
PHP
6
2016-09-22T01:00:17
True
False
False
Apr 03, 2014 at 11:33 PM
/api/public/snipt/105446/
php-date-triggered-events
<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> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$time_passed</span> <span class="o">=</span> <span class="p">(</span><span class="nb">time</span><span class="p">()</span> <span class="o">&gt;</span> <span class="nb">strtotime</span><span class="p">(</span><span class="s1">&#39;2014-01-18 00:00:00&#39;</span><span class="p">));</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a> <span class="k">if</span> <span class="p">(</span><span class="nv">$time_passed</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="c1">// Do something</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">}</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
Date, PHP
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.