snipt

Ctrl+h for KB shortcuts

Java

Parse dates Java

DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date today = df.parse("20/12/2005");
https://snipt.net/embed/fc23f73cdcf50bb255e1e29c0ebe26e5/
https://snipt.net/raw/fc23f73cdcf50bb255e1e29c0ebe26e5/
fc23f73cdcf50bb255e1e29c0ebe26e5
java
Java
2
2016-09-22T19:24:54
True
False
False
/api/public/snipt/23036/
parse-dates-java
<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="n">DateFormat</span> <span class="n">df</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SimpleDateFormat</span><span class="o">(</span><span class="s">&quot;dd/MM/yyyy&quot;</span><span class="o">);</span> </span><span id="L-2"><a name="L-2"></a><span class="n">Date</span> <span class="n">today</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="na">parse</span><span class="o">(</span><span class="s">&quot;20/12/2005&quot;</span><span class="o">);</span> </span></pre></div> </td></tr></table>
date, java, parser
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.