<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: How to format date for display or to use in a shell script</title> <atom:link href="http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Lernen</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-66339</link> <dc:creator>Lernen</dc:creator> <pubDate>Wed, 04 Jan 2012 07:34:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-66339</guid> <description>Thank you!! I tried to format a date string for myself but date --help didnt show anything about the &quot;+&quot; which is important for formating.... -.- thanks again!</description> <content:encoded><![CDATA[<p>Thank you!! I tried to format a date string for myself but date &#8211;help didnt show anything about the &#8220;+&#8221; which is important for formating&#8230;. -.- thanks again!</p> ]]></content:encoded> </item> <item><title>By: Vinay</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-65611</link> <dc:creator>Vinay</dc:creator> <pubDate>Wed, 14 Dec 2011 11:08:55 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-65611</guid> <description>date --date=&#039;yesterday&#039;
date --date=&#039;yesterday&#039; +%Y-%m-%d</description> <content:encoded><![CDATA[<p>date &#8211;date=&#8217;yesterday&#8217;<br
/> date &#8211;date=&#8217;yesterday&#8217; +%Y-%m-%d</p> ]]></content:encoded> </item> <item><title>By: Another Guy</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-61818</link> <dc:creator>Another Guy</dc:creator> <pubDate>Tue, 23 Aug 2011 19:29:15 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-61818</guid> <description>How do I get the day of the week for tomorrow and the day after?  For example, if today is Monday, how can I get &quot;Tuesday&quot; and &quot;Wednesday&quot;?  I have weather data for day2 and day3 from getwthr.com (for GeekTool) but need the days of the week to apply it to.
Thanks.</description> <content:encoded><![CDATA[<p>How do I get the day of the week for tomorrow and the day after?  For example, if today is Monday, how can I get &#8220;Tuesday&#8221; and &#8220;Wednesday&#8221;?  I have weather data for day2 and day3 from getwthr.com (for GeekTool) but need the days of the week to apply it to.</p><p>Thanks.</p> ]]></content:encoded> </item> <item><title>By: phpsnook</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-60559</link> <dc:creator>phpsnook</dc:creator> <pubDate>Fri, 08 Jul 2011 11:44:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-60559</guid> <description>echo 1313675999 &#124; perl -e &#039;use Time::localtime; $tm=localtime(); printf(&quot;%d/%d/%d\n&quot;, $tm-&gt;mday, $tm-&gt;mon+1, $tm-&gt;year+1900);&#039;</description> <content:encoded><![CDATA[<p>echo 1313675999 | perl -e &#8216;use Time::localtime; $tm=localtime(); printf(&#8220;%d/%d/%d\n&#8221;, $tm-&gt;mday, $tm-&gt;mon+1, $tm-&gt;year+1900);&#8217;</p> ]]></content:encoded> </item> <item><title>By: phpsnook</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-60554</link> <dc:creator>phpsnook</dc:creator> <pubDate>Fri, 08 Jul 2011 07:25:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-60554</guid> <description>Hi i have a unix date in file a file like this &#039;1313675999&#039;
in oracle i would do it like this
select TO_CHAR (  TO_DATE (&#039;01011970&#039;, &#039;DDMMYYYY&#039;)+ 1 / 24 / 60 / 60 * 1313675999,&#039;YYYYMMDD&#039;) from dual
how to achive the same in unix ?</description> <content:encoded><![CDATA[<p>Hi i have a unix date in file a file like this &#8217;1313675999&#8242;<br
/> in oracle i would do it like this</p><p>select TO_CHAR (  TO_DATE (&#8217;01011970&#8242;, &#8216;DDMMYYYY&#8217;)+ 1 / 24 / 60 / 60 * 1313675999,&#8217;YYYYMMDD&#8217;) from dual</p><p>how to achive the same in unix ?</p> ]]></content:encoded> </item> <item><title>By: soumita</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-59765</link> <dc:creator>soumita</dc:creator> <pubDate>Fri, 03 Jun 2011 07:30:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-59765</guid> <description>Hi,
I am writing a script which needs 2 arguments - arg1: current date &amp; time,arg2: 5 min after date &amp; time.Can anyone help me how to get after 5 min time of current time in sun 5.10?I have tried with the below syntax, but it is not working.
a=`date &quot;+%Y%m%d %T&quot; -d &quot;+5 min&quot;`</description> <content:encoded><![CDATA[<p>Hi,</p><p>I am writing a script which needs 2 arguments &#8211; arg1: current date &amp; time,arg2: 5 min after date &amp; time.Can anyone help me how to get after 5 min time of current time in sun 5.10?I have tried with the below syntax, but it is not working.</p><p>a=`date &#8220;+%Y%m%d %T&#8221; -d &#8220;+5 min&#8221;`</p> ]]></content:encoded> </item> <item><title>By: saianth chemate</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-56142</link> <dc:creator>saianth chemate</dc:creator> <pubDate>Sat, 05 Mar 2011 05:56:56 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-56142</guid> <description>hellow.....
I was thinking for writing code for the date formate comperison
if any one having any idea abt it plz informe me.......
i willl apriciate that...</description> <content:encoded><![CDATA[<p>hellow&#8230;..<br
/> I was thinking for writing code for the date formate comperison<br
/> if any one having any idea abt it plz informe me&#8230;&#8230;.<br
/> i willl apriciate that&#8230;</p> ]]></content:encoded> </item> <item><title>By: Amit Jain</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-52437</link> <dc:creator>Amit Jain</dc:creator> <pubDate>Wed, 15 Dec 2010 06:48:35 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-52437</guid> <description>Thanks a lot it helped.</description> <content:encoded><![CDATA[<p>Thanks a lot it helped.</p> ]]></content:encoded> </item> <item><title>By: Balaswamy vaddeman</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49669</link> <dc:creator>Balaswamy vaddeman</dc:creator> <pubDate>Wed, 22 Sep 2010 05:19:26 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49669</guid> <description>Thank you Bhavesh ,%b option also worked for me.</description> <content:encoded><![CDATA[<p>Thank you Bhavesh ,%b option also worked for me.</p> ]]></content:encoded> </item> <item><title>By: bhavesh</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49508</link> <dc:creator>bhavesh</dc:creator> <pubDate>Mon, 13 Sep 2010 23:42:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49508</guid> <description>@Balaswamy : easiest way to print months in alphabets format is using CASE</description> <content:encoded><![CDATA[<p>@Balaswamy : easiest way to print months in alphabets format is using CASE</p> ]]></content:encoded> </item> <item><title>By: Vivek Gite</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49084</link> <dc:creator>Vivek Gite</dc:creator> <pubDate>Sat, 28 Aug 2010 09:26:40 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49084</guid> <description>Tested with GNU date:
&lt;pre&gt;date +&quot;%b&quot;
date +&quot;%b&quot; --date=&quot;1 month ago&quot;
for d in {1..6}; do date +&quot;%b&quot; --date=&quot;$d month ago&quot;; done
man date&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Tested with GNU date:</p><pre>date +"%b"
date +"%b" --date="1 month ago"
for d in {1..6}; do date +"%b" --date="$d month ago"; done
man date</pre>]]></content:encoded> </item> <item><title>By: Balaswamy vaddeman</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49083</link> <dc:creator>Balaswamy vaddeman</dc:creator> <pubDate>Sat, 28 Aug 2010 09:18:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-49083</guid> <description>it is good one for unix beginners.
I want to display month in aphabets like Jan ,Feb and Mar.
anybody suggest me command for that. thank you in advance.</description> <content:encoded><![CDATA[<p>it is good one for unix beginners.<br
/> I want to display month in aphabets like Jan ,Feb and Mar.<br
/> anybody suggest me command for that. thank you in advance.</p> ]]></content:encoded> </item> <item><title>By: Guy</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46567</link> <dc:creator>Guy</dc:creator> <pubDate>Wed, 24 Mar 2010 21:57:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46567</guid> <description>So I got this from a friend, how recommended to use perl:
CURR_DATE=`perl -e &#039;use POSIX qw(strftime);$d = strftime &quot;%m/%e/%Y %H:%M:%S&quot;, localtime(time);print $d;&#039;`
START_DATE=` perl -e &#039;use POSIX qw(strftime);$d = strftime &quot;%m/%e/%Y %H:%M:%S&quot;, localtime(time() - 43200);print $d;&#039;`
echo $CURR_DATE
echo $START_DATE
This works great!!</description> <content:encoded><![CDATA[<p>So I got this from a friend, how recommended to use perl:</p><p>CURR_DATE=`perl -e &#8216;use POSIX qw(strftime);$d = strftime &#8220;%m/%e/%Y %H:%M:%S&#8221;, localtime(time);print $d;&#8217;`<br
/> START_DATE=` perl -e &#8216;use POSIX qw(strftime);$d = strftime &#8220;%m/%e/%Y %H:%M:%S&#8221;, localtime(time() &#8211; 43200);print $d;&#8217;`<br
/> echo $CURR_DATE<br
/> echo $START_DATE</p><p>This works great!!</p> ]]></content:encoded> </item> <item><title>By: Guy</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46565</link> <dc:creator>Guy</dc:creator> <pubDate>Wed, 24 Mar 2010 20:51:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46565</guid> <description>I should mentioned that I am using SunOS 5.10
As I have tried
E=$(date --date=&#039;-12 hours&#039;)
and it&#039;s not working!
I get this error:
date: illegal option -- date=-12 hours
usage:  date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]</description> <content:encoded><![CDATA[<p>I should mentioned that I am using SunOS 5.10<br
/> As I have tried<br
/> E=$(date &#8211;date=&#8217;-12 hours&#8217;)<br
/> and it&#8217;s not working!</p><p>I get this error:<br
/> date: illegal option &#8212; date=-12 hours<br
/> usage:  date [-u] mmddHHMM[[cc]yy][.SS]<br
/> date [-u] [+format]<br
/> date -a [-]sss[.fff]</p> ]]></content:encoded> </item> <item><title>By: Guy</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46564</link> <dc:creator>Guy</dc:creator> <pubDate>Wed, 24 Mar 2010 20:41:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46564</guid> <description>Hi everyone!
This is a great document that covers most of my date/time issues :-)
However I am trying to cron a job that will execute my bash script, the challenge that I am facing is I need to run the script for the last 12 hours, here is what I have:
#!/usr/bin/bash
# Set the current local time in this format: &#039;03/18/2010 17:52:18&#039;
CURR_DATE=`date +%m/%d/%Y&quot; &quot;%H:%M:%S`
#Set the start time (current time - 12 hours) &lt;-- This is where I am stuck!!!
START_DATE=`date +%m/%d/%Y&quot; &quot;%T`
How do set the start time to CURR_DATE   -12 hours???
Thanks,
guy</description> <content:encoded><![CDATA[<p>Hi everyone!<br
/> This is a great document that covers most of my date/time issues :-)</p><p>However I am trying to cron a job that will execute my bash script, the challenge that I am facing is I need to run the script for the last 12 hours, here is what I have:</p><p>#!/usr/bin/bash<br
/> # Set the current local time in this format: &#8217;03/18/2010 17:52:18&#8242;<br
/> CURR_DATE=`date +%m/%d/%Y&#8221; &#8220;%H:%M:%S`<br
/> #Set the start time (current time &#8211; 12 hours) &lt;&#8211; This is where I am stuck!!!<br
/> START_DATE=`date +%m/%d/%Y&quot; &quot;%T`</p><p>How do set the start time to CURR_DATE   -12 hours???</p><p>Thanks,<br
/> guy</p> ]]></content:encoded> </item> <item><title>By: Miroslav</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46209</link> <dc:creator>Miroslav</dc:creator> <pubDate>Tue, 02 Mar 2010 14:56:27 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-46209</guid> <description>I setup linux script to delete my backups older than few days:
RBRDAN=`date --date=&quot;3 days ago&quot; +%w`
rm /u02/oracle/backup/rman/$RBRDAN/*
But, I got error:
rm: cannot remove `/u02/oracle/backup/rman/6\r/*&#039;: No such file or directory
For some reason, it gives me &quot;\r&quot; at the end of the day. Instead of &quot;6&quot;, it gives me &quot;6\r&quot;.
Does anybody know what is the problem.
Thanks.</description> <content:encoded><![CDATA[<p>I setup linux script to delete my backups older than few days:<br
/> RBRDAN=`date &#8211;date=&#8221;3 days ago&#8221; +%w`</p><p>rm /u02/oracle/backup/rman/$RBRDAN/*</p><p>But, I got error:<br
/> rm: cannot remove `/u02/oracle/backup/rman/6\r/*&#8217;: No such file or directory</p><p>For some reason, it gives me &#8220;\r&#8221; at the end of the day. Instead of &#8220;6&#8243;, it gives me &#8220;6\r&#8221;.<br
/> Does anybody know what is the problem.</p><p>Thanks.</p> ]]></content:encoded> </item> <item><title>By: Me</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-44379</link> <dc:creator>Me</dc:creator> <pubDate>Fri, 30 Oct 2009 07:52:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-44379</guid> <description>Thanks  a BUNCH !
That was simple and effective for the beginners.</description> <content:encoded><![CDATA[<p>Thanks  a BUNCH !<br
/> That was simple and effective for the beginners.</p> ]]></content:encoded> </item> <item><title>By: Vivek Gite</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-44046</link> <dc:creator>Vivek Gite</dc:creator> <pubDate>Fri, 09 Oct 2009 08:02:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-44046</guid> <description>Try
&lt;a href=&quot;http://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html&quot; rel=&quot;nofollow&quot;&gt;
Getting Yesterdays or Tomorrows day with shell date command&lt;/a&gt;</description> <content:encoded><![CDATA[<p>Try</p><p><a
href="http://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html" rel="nofollow"><br
/> Getting Yesterdays or Tomorrows day with shell date command</a></p> ]]></content:encoded> </item> <item><title>By: Mangesh</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-44045</link> <dc:creator>Mangesh</dc:creator> <pubDate>Fri, 09 Oct 2009 07:30:26 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-44045</guid> <description>How to display yesterday date?</description> <content:encoded><![CDATA[<p>How to display yesterday date?</p> ]]></content:encoded> </item> <item><title>By: ashwani</title><link>http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-42119</link> <dc:creator>ashwani</dc:creator> <pubDate>Thu, 18 Jun 2009 10:43:16 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/#comment-42119</guid> <description>for space we can use \
see the output
Work Hard buddy [root@server1 04:05 PM]\  date +%F\ %r
2009-06-18 04:05:45 PM</description> <content:encoded><![CDATA[<p>for space we can use \<br
/> see the output<br
/> Work Hard buddy [root@server1 04:05 PM]\  date +%F\ %r<br
/> 2009-06-18 04:05:45 PM</p> ]]></content:encoded> </item> </channel> </rss>
