calendar in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users calendar in unix
# 8  
Old 02-15-2011
OMG ....
i was not aware of this %100 and %400 tricky subtility in the "leap year" definition ...
Thx for clarification !

Code:
chk_leap(){
[[ $(($1%400)) -eq 0 ]] || [[ $(($1%100)) -ne 0 ]] && [[  $(($1%4)) -eq 0 ]] && echo "$1 IS a leap year" || echo "$1 is  NOT leap year"
}
chk_leap "$1"

Smilie

Last edited by ctsgnb; 02-15-2011 at 01:29 PM..
# 9  
Old 02-15-2011
Remember also that as you go backwards, there are missing days when calendars were 'corrected'.

From "The Mystery of the Missing Days" on www.genealogytoday.com
Quote:
On September 2, 1752, an odd happening occurred that's still keeping genealogists on their toes. On that day, the British Isles and all the English colonies, including America, lost 11 days--September 3 through 13. People went to sleep and when they awoke the next morning, the date had changed to September 14. There were riots in rural villages since the people thought the government was trying to cheat them out of 11 days of their lives. Though these days disappeared in English lands in 1752, a number had already vanished in other places--France in 1582, Austria in 1584, and Norway in 1700.
Personally I can't even remember when I was a lad, but I suppose there may be a need to go back this far and it has been coded by someone.
Code:
RBATTE1 @ /usr/home/RBATTE1>cal 1752

                                1752

          January                     February         
Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  
             1   2   3   4                            1
 5   6   7   8   9  10  11    2   3   4   5   6   7   8
12  13  14  15  16  17  18    9  10  11  12  13  14  15
19  20  21  22  23  24  25   16  17  18  19  20  21  22
26  27  28  29  30  31       23  24  25  26  27  28  29

           March                        April          
Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  
 1   2   3   4   5   6   7                1   2   3   4
 8   9  10  11  12  13  14    5   6   7   8   9  10  11
15  16  17  18  19  20  21   12  13  14  15  16  17  18
22  23  24  25  26  27  28   19  20  21  22  23  24  25
29  30  31                   26  27  28  29  30

            May                         June           
Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  
                     1   2        1   2   3   4   5   6
 3   4   5   6   7   8   9    7   8   9  10  11  12  13
10  11  12  13  14  15  16   14  15  16  17  18  19  20
17  18  19  20  21  22  23   21  22  23  24  25  26  27
24  25  26  27  28  29  30   28  29  30
31
           July                        August          
Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  
             1   2   3   4                            1
 5   6   7   8   9  10  11    2   3   4   5   6   7   8
12  13  14  15  16  17  18    9  10  11  12  13  14  15
19  20  21  22  23  24  25   16  17  18  19  20  21  22
26  27  28  29  30  31       23  24  25  26  27  28  29
                             30  31
         September                     October         
Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  
         1   2  14  15  16    1   2   3   4   5   6   7
17  18  19  20  21  22  23    8   9  10  11  12  13  14
24  25  26  27  28  29  30   15  16  17  18  19  20  21
                             22  23  24  25  26  27  28
                             29  30  31

         November                     December         
Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  
             1   2   3   4                        1   2
 5   6   7   8   9  10  11    3   4   5   6   7   8   9
12  13  14  15  16  17  18   10  11  12  13  14  15  16
19  20  21  22  23  24  25   17  18  19  20  21  22  23
26  27  28  29  30           24  25  26  27  28  29  30
                             31

RBATTE1 @ /usr/home/RBATTE1>

Do I get a saddo badge for this? Smilie

Anyway, I suppose one should ask why you want to get this far through the calendars and see if we can help address that issue.



Robin
Liverpool/Blackburn
UK
# 10  
Old 02-15-2011
Yep, those days are missing because of the correction that was required when switching from the Julian calendar to the Gregorian.

On a side note: today (Feb 15) 30 years ago the British switched to base 10 in their currency. IMO there's a pattern here when it comes to the Empire and international standards Smilie
# 11  
Old 02-15-2011
I think you will find it was forty years ago, i.e. 1971 and before I was born Smilie it must have been lost in translation somewhere, like the letter u in the correct spelling of colour. Smilie


Robin
# 12  
Old 02-15-2011
Quote:
Originally Posted by rbatte1
I think you will find it was forty years ago, i.e. 1971 and before I was born Smilie it must have been lost in translation somewhere, like the letter u in the correct spelling of colour. Smilie


Robin
You have a strange sense of humor Smilie

But it was 40 years, just after I was born. I'm glad they changed it. I couldn't make head nor tail of it before!
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Autosys - Extended Calendar

Does anyone know if you can create an Extended Calendar in Autosys that will do the following...Schedule on the last business day of the month, but if the last business day falls on a Mon-Thur...schedule on the next business day (1st of the next month) ? (1 Reply)
Discussion started by: amarq0004
1 Replies

2. Shell Programming and Scripting

sort calendar files

I have a few .calendar files /usr/share/calendar they look like 01/01<TAB>Anniversary of the Triumph of the Revolution in Cuba 01/24<TAB>Gold discovered in California at Sutter's Mill, 1848 01/28<TAB>First ski tow, Woodstock VT, 1914 01/28<TAB>Space Shuttle Challenger (51-L) explodes 74... (2 Replies)
Discussion started by: p100x1
2 Replies

3. Shell Programming and Scripting

Calendar AWK

Hi, how should I use system command cal (calendar) in awk?, I have try several combinations and none works. Here what I have done. awk -f '{print cal}' awk -f '{print 'cal'}' awk -f '{print "cal"}' awk -f {print cal} Regards. (2 Replies)
Discussion started by: Godie
2 Replies

4. Shell Programming and Scripting

Help with filtering dates from the calendar

Hi, I need a simple shell script to help filter weekends from the calendar of a month. In other words, i need a script to identify the working days in a month. (3 Replies)
Discussion started by: pravsripad
3 Replies

5. Web Development

Calendar on web - newbie

Hi folks, I am kind of new to these things. I want to create a web based database which will serve as a sort of vacation calendar for the employees so that we know how many men we have at a given date. We want this to be seen on internal pages only, so it will be accessed by a username and... (3 Replies)
Discussion started by: apprentice
3 Replies

6. Shell Programming and Scripting

autosys calendar

Hi, Is there any autosys calendar for last day of a month(irrespective of holidays) For eg., Jan 31, Feb 28(29), Mar 31, Apr 30 ... Thanks in Advance (2 Replies)
Discussion started by: rspk_praveen
2 Replies

7. UNIX for Dummies Questions & Answers

what command can show calendar in unix system?

what command can show calendar in unix system? (2 Replies)
Discussion started by: kennethchow
2 Replies
Login or Register to Ask a Question