<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: prompt date string with bash in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911270#M104348</link>
    <description>Before:&lt;BR /&gt;&lt;BR /&gt;# env | grep TZ&lt;BR /&gt;# TZ=MST7MDT&lt;BR /&gt;&lt;BR /&gt;on this setting, a command "env TZ=JST+15 date" does not provide the correct answer.  As above command, my timezone is JST so that TZ variable must change to JST.  I changed it to JST,&lt;BR /&gt;&lt;BR /&gt;After:&lt;BR /&gt;&lt;BR /&gt;# env | grep TZ&lt;BR /&gt;# TZ=JST-9&lt;BR /&gt;&lt;BR /&gt;then, the command works.  The command gets yesterday's date.&lt;BR /&gt;</description>
    <pubDate>Tue, 23 Aug 2005 23:34:32 GMT</pubDate>
    <dc:creator>kazu_1</dc:creator>
    <dc:date>2005-08-23T23:34:32Z</dc:date>
    <item>
      <title>prompt date string with bash</title>
      <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911265#M104343</link>
      <description>I have stack with making shell programming.  I hope somebody will help me!&lt;BR /&gt;&lt;BR /&gt;[objective]&lt;BR /&gt;Try to prompt date string that shows the date of 2 month ago from today.&lt;BR /&gt;&lt;BR /&gt;I know how to make it on Solaris and Aix.&lt;BR /&gt;eg. dst=`env TZ=JST+1440 date +%Y%m%d`&lt;BR /&gt;    echo $dst&lt;BR /&gt;This will prompt like 20050504&lt;BR /&gt;&lt;BR /&gt;However, it doesn't work on HPUX...  Please does sombody give me some advice.&lt;BR /&gt;&lt;BR /&gt;Thank you in advance.</description>
      <pubDate>Fri, 08 Jul 2005 01:48:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911265#M104343</guid>
      <dc:creator>kazu_1</dc:creator>
      <dc:date>2005-07-08T01:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: prompt date string with bash</title>
      <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911266#M104344</link>
      <description>Kazu,&lt;BR /&gt;&lt;BR /&gt;here is one way&lt;BR /&gt;echo $(sh -c "TZ=$(date +%Z)+1440; export TZ; date '+%m%d%y'")&lt;BR /&gt;&lt;BR /&gt;where 1440 is the number of hours between two  months which I have taken from your example above&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;Devesh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Jul 2005 19:23:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911266#M104344</guid>
      <dc:creator>Devesh Pant_1</dc:creator>
      <dc:date>2005-07-08T19:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: prompt date string with bash</title>
      <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911267#M104345</link>
      <description>First of all, the date 2 months ago is a very imprecise designation. For example, what is 2 months before 30-Apr-2005. 30-Feb-2005? I don't think so. If you change your question to something like 60 before today then thats much easier.&lt;BR /&gt;&lt;BR /&gt;Use the attached caljd.sh (or search for caljd.pl; it works just the same).&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;DT=$(caljd.sh -y -s $(caljd.sh -p 60))&lt;BR /&gt;echo "60 days ago was ${DT}"&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage and examples.</description>
      <pubDate>Fri, 08 Jul 2005 19:29:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911267#M104345</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-07-08T19:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: prompt date string with bash</title>
      <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911268#M104346</link>
      <description>Kazu,&lt;BR /&gt;I forgot you wanted it in a script, I gave i for the command line&lt;BR /&gt;okay here it is &lt;BR /&gt;&lt;BR /&gt;dst=`sh -c "TZ=$(date +%Z)+1440; export TZ; date '+%m%d%y'")`&lt;BR /&gt;echo $dst           &lt;BR /&gt;&lt;BR /&gt;DP</description>
      <pubDate>Fri, 08 Jul 2005 19:29:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911268#M104346</guid>
      <dc:creator>Devesh Pant_1</dc:creator>
      <dc:date>2005-07-08T19:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: prompt date string with bash</title>
      <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911269#M104347</link>
      <description>Hello Devesh and Clay.&lt;BR /&gt;&lt;BR /&gt;Sorry for replying so late.  I appliciate what you have given me advice and tips.&lt;BR /&gt;&lt;BR /&gt;Now I have found why I couldn't get the target date.  The reason is that the environmental variable TZ was set to "MST7MDT".  I changed it to "JST-9", then the command "env TZ=JST+15 date" works!&lt;BR /&gt;&lt;BR /&gt;Sorry for putting such a dum thread... I'm going to close this thread.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;kazu&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Aug 2005 23:27:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911269#M104347</guid>
      <dc:creator>kazu_1</dc:creator>
      <dc:date>2005-08-23T23:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: prompt date string with bash</title>
      <link>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911270#M104348</link>
      <description>Before:&lt;BR /&gt;&lt;BR /&gt;# env | grep TZ&lt;BR /&gt;# TZ=MST7MDT&lt;BR /&gt;&lt;BR /&gt;on this setting, a command "env TZ=JST+15 date" does not provide the correct answer.  As above command, my timezone is JST so that TZ variable must change to JST.  I changed it to JST,&lt;BR /&gt;&lt;BR /&gt;After:&lt;BR /&gt;&lt;BR /&gt;# env | grep TZ&lt;BR /&gt;# TZ=JST-9&lt;BR /&gt;&lt;BR /&gt;then, the command works.  The command gets yesterday's date.&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Aug 2005 23:34:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/prompt-date-string-with-bash/m-p/4911270#M104348</guid>
      <dc:creator>kazu_1</dc:creator>
      <dc:date>2005-08-23T23:34:32Z</dc:date>
    </item>
  </channel>
</rss>

