snipt

Ctrl+h for KB shortcuts

Text only

Show current year in php

<?php echo date("Y")?>
https://snipt.net/embed/766fe8a613da35ef37bf28312bb7021c/
https://snipt.net/raw/766fe8a613da35ef37bf28312bb7021c/
766fe8a613da35ef37bf28312bb7021c
text
Text only
1
2016-09-27T07:33:20
True
False
False
Sep 13, 2012 at 05:58 AM
/api/public/snipt/47127/
show-current-year-in-php
<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>&lt;?php echo date(&quot;Y&quot;)?&gt; </span></pre></div> </td></tr></table>
date, php, year

PHP

Dynamic Copyright Year In Your Footer

<p>copyright © 2006-<?php echo date('Y'); ?> mysite.com</p>
https://snipt.net/embed/dae170aeb0327a786b7b23116b5b74b2/
https://snipt.net/raw/dae170aeb0327a786b7b23116b5b74b2/
dae170aeb0327a786b7b23116b5b74b2
php
PHP
1
2016-09-28T06:58:20
True
False
False
/api/public/snipt/42194/
dynamic-copyright-year-in-your-footer
<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><span class="x">&lt;p&gt;copyright © 2006-</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">date</span><span class="p">(</span><span class="s1">&#39;Y&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"> mysite.com&lt;/p&gt;</span> </span></pre></div> </td></tr></table>
current, year

PHP

get year

<?php echo date("Y") ;?>
https://snipt.net/embed/699b775da18a592eb1d858d94c5e3cb8/
https://snipt.net/raw/699b775da18a592eb1d858d94c5e3cb8/
699b775da18a592eb1d858d94c5e3cb8
php
PHP
1
2016-09-28T18:20:20
True
False
False
/api/public/snipt/38222/
get-year
<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><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="p">;</span><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
php, year

Ruby

current year for copyright

1
2
3
4
5
6
&copy; Copyright <%= current_year -%>.

## Add to application helper
def current_year
    Time.now.strftime('%Y')
end
https://snipt.net/embed/8e3f25eeb97c3ae023e9c85afc74ff8a/
https://snipt.net/raw/8e3f25eeb97c3ae023e9c85afc74ff8a/
8e3f25eeb97c3ae023e9c85afc74ff8a
rb
Ruby
7
2016-09-28T18:50:13
True
False
False
/api/public/snipt/2705/
current-year-for-copyright
<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="o">&amp;</span><span class="n">copy</span><span class="p">;</span> <span class="no">Copyright</span> <span class="o">&lt;%=</span> <span class="n">current_year</span> <span class="o">-%&gt;.</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1">## Add to application helper</span> </span><span id="L-4"><a name="L-4"></a><span class="k">def</span> <span class="nf">current_year</span> </span><span id="L-5"><a name="L-5"></a> <span class="no">Time</span><span class="o">.</span><span class="n">now</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s1">&#39;%Y&#39;</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a><span class="k">end</span> </span></pre></div> </td></tr></table>
rails, ruby, year

Django/Jinja

How long Years Field Chose

years = list((('%s' % x, '%s' % x) for x in range(1,100)))
https://snipt.net/embed/9284a08f3f2a46cf3be5f28f481d9820/
https://snipt.net/raw/9284a08f3f2a46cf3be5f28f481d9820/
9284a08f3f2a46cf3be5f28f481d9820
django
Django/Jinja
1
2016-09-29T05:16:42
True
False
False
/api/public/snipt/362/
how-long-years-field-chose
<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><span class="x">years = list(((&#39;%s&#39; % x, &#39;%s&#39; % x) for x in range(1,100)))</span> </span></pre></div> </td></tr></table>
choices, django, field, python, year
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.