<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Beaton :: FAQ &#187; date</title>
	<atom:link href="http://andrewbeaton.net/faq/tag/date/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewbeaton.net/faq</link>
	<description>Tips from the world of a software developer</description>
	<lastBuildDate>Wed, 13 Jul 2011 17:03:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Get DateTime in YYYY-mm-dd HH:MM:SS format using Perl</title>
		<link>http://andrewbeaton.net/faq/2011/04/14/get-datetime-in-yyyy-mm-dd-hhmmss-format-using-perl/</link>
		<comments>http://andrewbeaton.net/faq/2011/04/14/get-datetime-in-yyyy-mm-dd-hhmmss-format-using-perl/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 11:54:34 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[localtime]]></category>
		<category><![CDATA[POSIX]]></category>
		<category><![CDATA[strftime]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[YYYY-mm-dd HH-MM-SS]]></category>

		<guid isPermaLink="false">http://andrewbeaton.net/faq/?p=133</guid>
		<description><![CDATA[For many years I&#8217;ve been using the long process of obtaining everything from localtime(), adding 1900 to the year etc. etc. but I&#8217;ve just come across the method below, which uses strftime from the POSIX module. use POSIX; &#160; my $DateTime = strftime &#34;%F %T&#34;, localtime $^T; This gives you: 2006-10-02 02:06:07 Now that&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>For many years I&#8217;ve been using the long process of obtaining everything from <em>localtime()</em>, adding  1900 to the year etc. etc. but I&#8217;ve just come across the method below, which uses <em>strftime</em> from the <a title="POSIX" href="http://perldoc.perl.org/POSIX.html">POSIX</a> module.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">use</span> POSIX<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$DateTime</span> <span style="color: #339933;">=</span> strftime <span style="color: #ff0000;">&quot;%F %T&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066;">localtime</span> <span style="color: #0000ff;">$^T</span><span style="color: #339933;">;</span></pre></div></div>

<p>This gives you:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">2006</span>-<span style="color: #000000;">10</span>-02 02:06:07</pre></div></div>

<p>Now that&#8217;s a lot easier!</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2011/04/14/get-datetime-in-yyyy-mm-dd-hhmmss-format-using-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set date and time in Linux</title>
		<link>http://andrewbeaton.net/faq/2009/11/13/set-date-and-time-in-linux/</link>
		<comments>http://andrewbeaton.net/faq/2009/11/13/set-date-and-time-in-linux/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 23:38:54 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://andrewbeaton.com/faq/?p=57</guid>
		<description><![CDATA[Use the following syntax to set new data and time: # date set=&#34;STRING&#34; For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user: # date -s &#34;2 OCT 2006 18:00:00&#34; OR # date set=&#34;2 OCT 2006 18:00:00&#34; You can also simplify format using following syntax: # date +%Y%m%d [...]]]></description>
			<content:encoded><![CDATA[<p>Use the following syntax to set new data and time:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># date set=&quot;STRING&quot;</span></pre></div></div>

<p>For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># date -s &quot;2 OCT 2006 18:00:00&quot;</span></pre></div></div>

<p>OR</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># date set=&quot;2 OCT 2006 18:00:00&quot;</span></pre></div></div>

<p>You can also simplify format using following syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># date +%Y%m%d -s &quot;20081128&quot;</span></pre></div></div>

<p>To set time use the following syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># date +%T -s &quot;10:13:13&quot;</span></pre></div></div>

<p>Where,</p>
<p>   * 10: Hour (hh)<br />
   * 13: Minute (mm)<br />
   * 30: Second (ss)</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewbeaton.net/faq/2009/11/13/set-date-and-time-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

