Skåne Sjælland Linux User Group - http://www.sslug.dk Forside   Tilmelding   Postarkiv   Forum   Kalender   Søg
MhonArc Dato: [Date Prev] [Kronologisk oversigt] [Date Next]   Tråd: [Date Prev] [Oversigt tråde] [Date Next]   MhonArc
 

Re: [PERL] Skuffet over "Perl Cookbook"



Peter Makholm wrote:

Christian Hansen <sslug@sslug> writes:


($YEARDAY) = (localtime)[7]
$WEEKNUM = int($YEARDAY/7) +1;

I følge ovenstående bør første dag på året altid være en mandag, og


Hint: Hvad tror du "int" gør

Det samme som int altid gør vel!


Hint2: Hvordan tror du de numererer uger i Usa?

Vel på samme måde som i Europa, i hvert fald hvis de følger iso standarden, som kan læses her: http://www.cl.cam.ac.uk/~mgk25/iso-time.html


Der står blandt andet følgende:

In commercial and industrial applications (delivery times, production plans, etc.), especially in Europe, it is often required to refer to a week of a year. Week 01 of a year is per definition the first week that has the Thursday in this year, which is equivalent to the week that contains the fourth day of January. In other words, the first week of a new year is the week that has the majority of its days in the new year. Week 01 might also contain days from the previous year and the week before week 01 of a year is the last week (52 or 53) of the previous year even if it contains days from the new year. A week starts with Monday (day 1) and ends with Sunday (day 7).

Spændende læsning og måske værd at vide, hvis man har brug for ugenumre og kalenderberegninger, som mange har.


Christian




 
Forside   Tilmelding   Postarkiv   Oversigt   Kalender   Søg

 
 
Henvendelse vedrørende websiderne til <www_admin>. Senest ændret 2005-08-10, klokken 19:53
Denne side vedligeholdes af MHonArc .