This week is ...
Week 49 is from Monday December 2, 2013 until (and including) Sunday December 8, 2013.
Week number according to the ISO-8601 standard, weeks starting on Monday. The first week of the year is the week that contains that year's first Thursday (='First 4-day week'). The highest week number in a year is either 52 or 53.
my $weekNumber = POSIX::strftime("%V", gmtime time);
Replace time with other epoch/UNIX timestamps for other week numbers.
$weekNumber = date("W");
date("W", epoch) for other week numbers. Remember to use capital 'W' not 'w'.
Calendar now = Calendar.getInstance(); now.get(Calendar.WEEK_OF_YEAR);
DateTime test_date = DateTime.Now; double week_of_year = Math.Ceiling(Convert.ToDouble(test_date.DayOfYear) / 7);
Replace now() with other dates eg.
(You can also use the WEEK function with mode=3
SELECT DATEPART( wk, GETDATE() )
SELECT to_char(sysdate, 'IW') FROM DUAL
IW: Week of year (1-52 or 1-53) based on the ISO 8601 standard.
WW: Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year (Mostly NOT used)
[NSString stringWithFormat:@"Week %d", [calendar ordinalityOfUnit:NSWeekCalendarUnit inUnit:NSYearCalendarUnit forDate:date]];
week_number = Time.now.strftime("%U")Replace Time.now with Time.local(year,month,day) for other dates.
%U - Week number of the year, starting with the first Sunday as the first day of the first week (00..53)
%V - Week number of year according to ISO 8601 (01..53)
%W - Week number of the year, starting with the first Monday as the first day of the first week (00..53)
=WEEKNUM(A1)-1Week numbers can vary based on your locality settings (not ISO-8601!). See discussion below.
date +%VReturns the ISO 8601 week number.
Other formats under 'Ruby'. More details on Kernel.org
Get-Date -UFormat %V
X++ (Microsoft Dynamics AX)
int weeknum; weeknum = weekOfYear(today());
Thanks to everyone who sent me corrections and updates!
Also see: Current day number
Comments and questionsblog comments powered by Disqus
Time zone converter
Unix hex timestamp
Routines by language
Epoch in C
Epoch in MySQL
Epoch in PERL
Epoch in PHP
between two dates
Weeks by year
Days by year
Comments & questions
Este sitio en Español
Character Set Tools