<?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: Retrieve week number and week day for a input date in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4949000#M413270</link>
    <description>Hi Aji:&lt;BR /&gt;&lt;BR /&gt;Here's a simple perl script that returns a three-item string denoting the day-of-the-week (1-7 where 1=Monday), the number of the week within the month (1-5) and the week-number (1-53) of the year.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use Date::Calc qw( Decode_Date_US Day_of_Week Week_of_Year );&lt;BR /&gt;die "Usage: $0 MMDDYYYY\n" unless @ARGV;&lt;BR /&gt;my  ($year, $month, $day);&lt;BR /&gt;if (($year, $month, $day) = Decode_Date_US($ARGV[0])) {&lt;BR /&gt;    print        Day_of_Week ($year, $month, $day), " ",&lt;BR /&gt;    int (($day + Day_of_Week ($year, $month, 1) - 2) / 7) + 1, " ",&lt;BR /&gt;    scalar       Week_of_Year($year, $month, $day), "\n";&lt;BR /&gt;}&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;Run the script by passing a US-format (MMDDYYYY) date either with or without delimiters:&lt;BR /&gt;&lt;BR /&gt;# ./daynums 01/01/2005&lt;BR /&gt;6 1 53&lt;BR /&gt;&lt;BR /&gt;...since 01/01/2005 was a Saturday (6) in the first (1) week of January but is reckoned as the LAST (53rd) week of the preceeding year, since no Monday had yet occured in 2005.&lt;BR /&gt;&lt;BR /&gt;# ./daynums 12/28/2005&lt;BR /&gt;3 5 52&lt;BR /&gt;&lt;BR /&gt;...a Wednesday (day-3) of the fifth (5) week of the month and the 52nd week of the year.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 28 Dec 2005 16:14:28 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2005-12-28T16:14:28Z</dc:date>
    <item>
      <title>Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948988#M413258</link>
      <description>Hi guys,&lt;BR /&gt;&lt;BR /&gt;I am writing a small shell script, and based on input date, it want to get the weeknum and weekday. One more thing, i want the week day starting from Saturday.&lt;BR /&gt;&lt;BR /&gt;I have &lt;BR /&gt;----------------------------------------&lt;BR /&gt;%U   Week number of the year (Sunday as the first day of the week)&lt;BR /&gt;&lt;BR /&gt;%V   Week number of the year (Monday as the first day of the week)&lt;BR /&gt;&lt;BR /&gt;%w   Weekday as a one-digit decimal number [0-6 (Sunday- Saturday)].  &lt;BR /&gt;&lt;BR /&gt;%W   Week number of the year (Monday as the first day of the week)&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Please advice,&lt;BR /&gt;AJi</description>
      <pubDate>Wed, 28 Dec 2005 02:25:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948988#M413258</guid>
      <dc:creator>Aji Thomas</dc:creator>
      <dc:date>2005-12-28T02:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948989#M413259</link>
      <description>Aji,&lt;BR /&gt;I would really recommend A.Clay Stephenson's caljd series of scripts at:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.ws/merijn/caljd-2.23.sh" target="_blank"&gt;http://hpux.ws/merijn/caljd-2.23.sh&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.ws/merijn/caljd-2.2.pl" target="_blank"&gt;http://hpux.ws/merijn/caljd-2.2.pl&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you really want to work out the day of the week search for Zeller's rule.&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Dec 2005 02:38:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948989#M413259</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-12-28T02:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948990#M413260</link>
      <description>Hi Peter&lt;BR /&gt;&lt;BR /&gt;Please can you verify the url provided. I cant access the webpage.&lt;BR /&gt;&lt;BR /&gt;As i would like to know whether there is any function in UNIX that is going to replace MOD&lt;BR /&gt;&lt;BR /&gt;Thanks for the support,&lt;BR /&gt;AJi</description>
      <pubDate>Wed, 28 Dec 2005 02:44:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948990#M413260</guid>
      <dc:creator>Aji Thomas</dc:creator>
      <dc:date>2005-12-28T02:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948991#M413261</link>
      <description>HI Aji,&lt;BR /&gt;&lt;BR /&gt;Check the Mirror hp-ux page  of H Merjin.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://mirrors.develooper.com/hpux/stats.html" target="_blank"&gt;http://mirrors.develooper.com/hpux/stats.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;At the bottom check for the scripts.&lt;BR /&gt;Hope it helps ,&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raj.</description>
      <pubDate>Wed, 28 Dec 2005 03:05:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948991#M413261</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2005-12-28T03:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948992#M413262</link>
      <description>Hello, Both scripts are attached. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Wed, 28 Dec 2005 03:11:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948992#M413262</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-12-28T03:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948993#M413263</link>
      <description>Is ACS script supporting to change first day of the week? I've checked with usage() function, nothing is relavent to change the first day of the week.&lt;BR /&gt;&lt;BR /&gt;Revert when someone find it.&lt;BR /&gt;&lt;BR /&gt;-Muthu</description>
      <pubDate>Wed, 28 Dec 2005 04:05:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948993#M413263</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-28T04:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948994#M413264</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply,&lt;BR /&gt;My purpose of the scripts is to include within my backup script to find alternate weeks.&lt;BR /&gt;Each week we backup up data to particular FileSystem FS, next week we backup to another FS.&lt;BR /&gt;I am trying to develop a script for this fuctionality based on date as input.&lt;BR /&gt;&lt;BR /&gt;I thought of getting it work based on week number, but if there are 53 weeks in a year, the logic does not work.&lt;BR /&gt;&lt;BR /&gt;Any idea???&lt;BR /&gt;&lt;BR /&gt;AJi&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Dec 2005 04:39:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948994#M413264</guid>
      <dc:creator>Aji Thomas</dc:creator>
      <dc:date>2005-12-28T04:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948995#M413265</link>
      <description>You may try as,&lt;BR /&gt;&lt;BR /&gt;Schedule script executing with cron tab on specific time on every week.&lt;BR /&gt;&lt;BR /&gt;Try to change to File system selection based on a variable or file availablity.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# touch /etc/filesystemselect&lt;BR /&gt;# cat &amp;gt; /etc/filesystemselect&lt;BR /&gt;FS=1&lt;BR /&gt;In the script,&lt;BR /&gt;&lt;BR /&gt;if [[ -f /etc/filesystemselect ]]&lt;BR /&gt;then&lt;BR /&gt; . /etc/filesystemselect  &lt;BR /&gt; if [[ ${FS} -eq 1 ]]&lt;BR /&gt; then&lt;BR /&gt;   # Action with file system one&lt;BR /&gt;   # change contents of /etc/fsselect&lt;BR /&gt;   echo "FS=2" &amp;gt; /etc/filesystemselect&lt;BR /&gt; elif [[ ${FS} -eq 2 ]]&lt;BR /&gt; then&lt;BR /&gt;   # Action with file system two&lt;BR /&gt;   # change contents of /etc/fsselect&lt;BR /&gt;   echo "FS=1" &amp;gt; /etc/filesystemselect&lt;BR /&gt; fi&lt;BR /&gt;else&lt;BR /&gt;  echo "ERROR: Which file system to be selected"&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;It will do your requirement. &lt;BR /&gt;&lt;BR /&gt;Note: /etc/filesystemselect must be there.&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Dec 2005 04:58:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948995#M413265</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-28T04:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948996#M413266</link>
      <description>Hi Muthu,&lt;BR /&gt;&lt;BR /&gt;How will it know which week to do the switch in filesystem.&lt;BR /&gt;&lt;BR /&gt;Say My week starts on SAT-FRI&lt;BR /&gt;Take the following example,&lt;BR /&gt;17th - 23rd Dec 2005 &lt;BR /&gt;&amp;gt; Backup should go to /prod1 filesystem.&lt;BR /&gt;&lt;BR /&gt;24th - 30th Dec 2005 &lt;BR /&gt;&amp;gt; Backup should go to /prod2 filesystem.&lt;BR /&gt;&lt;BR /&gt;31th Dec 2005 - 6th Jan 2006&lt;BR /&gt;&amp;gt; Backup should go to /prod1 filesystem.&lt;BR /&gt;&lt;BR /&gt;Please advice,&lt;BR /&gt;AJi</description>
      <pubDate>Wed, 28 Dec 2005 05:10:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948996#M413266</guid>
      <dc:creator>Aji Thomas</dc:creator>
      <dc:date>2005-12-28T05:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948997#M413267</link>
      <description>Hi Aji,&lt;BR /&gt;&lt;BR /&gt;perhaps you can figure out which fs to use  with the help of Stephenson's script and a bit of convention: enter the correct path to Stephenson's script in the script below and try executing that with three parameters for month, day, and year, e.g. for 31 DEC 2005:&lt;BR /&gt;# ./find_fs.sh 12 31 2005&lt;BR /&gt;which should produce&lt;BR /&gt;12 31 2005 should use prod1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The convention is that you cannot enter a date before Dec 23 2005. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;CALJD=./caljd-2.23.shi # enter path to script&lt;BR /&gt;CURRENT_JD=$($CALJD $1 $2 $3)&lt;BR /&gt;if [ "$#" != 3 ]&lt;BR /&gt;then&lt;BR /&gt;        echo wrong number of parameters&lt;BR /&gt;        exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# Starting point, first day is 23 dec 2005&lt;BR /&gt;DAY_ONE_JD=2453722&lt;BR /&gt;&lt;BR /&gt;# How many days since start&lt;BR /&gt;PASSED_DAYS=$(( $CURRENT_JD - $DAY_ONE_JD))&lt;BR /&gt;&lt;BR /&gt;# in chunks of fortnights...&lt;BR /&gt;let DAY_NUM=PASSED_DAYS%14&lt;BR /&gt;case $DAY_NUM in&lt;BR /&gt;        0|1|2|3|4|5|6)  FS=1;;&lt;BR /&gt;        7|8|9|10|11|12|13) FS=2;;&lt;BR /&gt;        esac&lt;BR /&gt;echo $1 $2 $3 should use prod$FS &lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Dec 2005 07:20:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948997#M413267</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-12-28T07:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948998#M413268</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;Thanks for the best support,&lt;BR /&gt;&lt;BR /&gt;Its works fine.&lt;BR /&gt;I forgot to mention one more thing. Every thursday we keep a weekly backup on different FSWEEK1 and FSWEEK2.&lt;BR /&gt;&lt;BR /&gt;For eg&lt;BR /&gt;22-dec-2005 - FSWEEK1&lt;BR /&gt;29-dec-2005 - FSWEEK2&lt;BR /&gt;5-jan-2006 - FSWEEK1&lt;BR /&gt;&lt;BR /&gt;and so on.&lt;BR /&gt;&lt;BR /&gt;Please suggest me script to include this also.&lt;BR /&gt;&lt;BR /&gt;Waiting for your expertize suggestions&lt;BR /&gt;AJi</description>
      <pubDate>Wed, 28 Dec 2005 09:02:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948998#M413268</guid>
      <dc:creator>Aji Thomas</dc:creator>
      <dc:date>2005-12-28T09:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948999#M413269</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;you can try the script with this extension:&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;FULL=""&lt;BR /&gt;CALJD=./caljd-2.23.sh&lt;BR /&gt;CURRENT_JD=$($CALJD $1 $2 $3)&lt;BR /&gt;if [ "$#" != 3 ]&lt;BR /&gt;then&lt;BR /&gt;        echo wrong number of parameters&lt;BR /&gt;        exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# Starting point, first day is 23 dec 2005&lt;BR /&gt;DAY_ONE_JD=2453722&lt;BR /&gt;&lt;BR /&gt;# How many days since start&lt;BR /&gt;PASSED_DAYS=$(( $CURRENT_JD - $DAY_ONE_JD))&lt;BR /&gt;&lt;BR /&gt;# in chunks of fortnights...&lt;BR /&gt;let DAY_NUM=PASSED_DAYS%14&lt;BR /&gt;case $DAY_NUM in&lt;BR /&gt;        0|1|2|3|4|5|6)  FS=1;;&lt;BR /&gt;        7|8|9|10|11|12|13) FS=2;;&lt;BR /&gt;        esac&lt;BR /&gt;echo $1 $2 $3 should use prod$FS&lt;BR /&gt;&lt;BR /&gt;case $DAY_NUM in&lt;BR /&gt;        5) FULL=FSWEEK1;;&lt;BR /&gt;        12) FULL=FSWEEK2;;&lt;BR /&gt;        esac&lt;BR /&gt;if [ "${FULL}X" != "X" ]&lt;BR /&gt;then&lt;BR /&gt;        # put code for full backup here&lt;BR /&gt;        echo use full bacup on $FULL&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But I suggest you do a lot of testing before letting the above control your backup!&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Wed, 28 Dec 2005 09:33:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4948999#M413269</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-12-28T09:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4949000#M413270</link>
      <description>Hi Aji:&lt;BR /&gt;&lt;BR /&gt;Here's a simple perl script that returns a three-item string denoting the day-of-the-week (1-7 where 1=Monday), the number of the week within the month (1-5) and the week-number (1-53) of the year.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use Date::Calc qw( Decode_Date_US Day_of_Week Week_of_Year );&lt;BR /&gt;die "Usage: $0 MMDDYYYY\n" unless @ARGV;&lt;BR /&gt;my  ($year, $month, $day);&lt;BR /&gt;if (($year, $month, $day) = Decode_Date_US($ARGV[0])) {&lt;BR /&gt;    print        Day_of_Week ($year, $month, $day), " ",&lt;BR /&gt;    int (($day + Day_of_Week ($year, $month, 1) - 2) / 7) + 1, " ",&lt;BR /&gt;    scalar       Week_of_Year($year, $month, $day), "\n";&lt;BR /&gt;}&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;Run the script by passing a US-format (MMDDYYYY) date either with or without delimiters:&lt;BR /&gt;&lt;BR /&gt;# ./daynums 01/01/2005&lt;BR /&gt;6 1 53&lt;BR /&gt;&lt;BR /&gt;...since 01/01/2005 was a Saturday (6) in the first (1) week of January but is reckoned as the LAST (53rd) week of the preceeding year, since no Monday had yet occured in 2005.&lt;BR /&gt;&lt;BR /&gt;# ./daynums 12/28/2005&lt;BR /&gt;3 5 52&lt;BR /&gt;&lt;BR /&gt;...a Wednesday (day-3) of the fifth (5) week of the month and the 52nd week of the year.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 28 Dec 2005 16:14:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4949000#M413270</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-28T16:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve week number and week day for a input date</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4949001#M413271</link>
      <description>Solved</description>
      <pubDate>Mon, 06 Feb 2006 03:16:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/retrieve-week-number-and-week-day-for-a-input-date/m-p/4949001#M413271</guid>
      <dc:creator>Aji Thomas</dc:creator>
      <dc:date>2006-02-06T03:16:48Z</dc:date>
    </item>
  </channel>
</rss>

