The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl Script : Split given month into weeks khushbu_roy Shell Programming and Scripting 5 02-22-2008 07:40 PM
how to check whether the given file is 5 weeks older than current date risshanth Shell Programming and Scripting 1 10-29-2007 12:53 AM
find a date two weeks ago? frustrated1 Shell Programming and Scripting 2 04-22-2006 07:33 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
How many weeks in a year

Hi,

I search how i could do to find if a year (for example 2004, 1989, 2058) has 52 or 53 weeks...
Have you a idea for me please???
__________________
AIX 5.2


C@stelior
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-28-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,314
Navigate:
Our Home Page -> Answers to Frequently Asked Questions -> Yesterdays Date/Date Arithmetic

and take a look at my datacalc routine.

Try to compute the Modified Julian Date of February 29 of the year in question. If you succeed you have a leap year which has too many days to be only 52 weeks.

A non-leap is 364 days which is exactly 7 * 52. In my mind such a year is always 52 weeks in length. But to determine if the year exactly comprises 52 weeks each starting with Sunday, compute the Day of the Week of Jan 1. If Jan 1 is a Sunday, the anwser is yes.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0