in reply to Another date question
Hello sshingor,
Welcome to the Monastery. I will agree with the fellow Monks that have already replied to your question. Just to add something minor here on how the week numbers are calculated.
Read the documentation from ISO_8601/Week_dates:
The week number can be described by counting the Thursdays: week 12 co +ntains the 12th Thursday of the year. The ISO week-numbering year starts at the first day (Monday) of week 0 +1 and ends at the Sunday before the new ISO year (hence without overl +ap or gap). It consists of 52 or 53 full weeks. The first ISO week of + a year may have up to three days that are actually in the Gregorian +calendar year that is ending; if three, they are Monday, Tuesday and +Wednesday. Similarly, the last ISO week of a year may have up to thre +e days that are actually in the Gregorian calendar year that is start +ing; if three, they are Friday, Saturday, and Sunday. The Thursday of + each ISO week is always in the Gregorian calendar year denoted by th +e ISO week-numbering year. Examples: Monday 29 December 2008 is written "2009-W01-1" Sunday 3 January 2010 is written "2009-W53-7"
Minor sample of code with Date::Manip:
#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $datestr = ParseDate("01/01/2016"); my $secs = UnixDate($datestr,'%s'); say ParseDateString("epoch $secs"); say UnixDate($datestr,"%J"); __END__ $ perl test.pl 2016010100:00:00 2015-W53-5
Hope this helps, BR.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Another date question
by SBECK (Chaplain) on Aug 27, 2018 at 12:36 UTC | |
by thanos1983 (Parson) on Aug 27, 2018 at 13:41 UTC |