week-number

ISO week number in CMD

时间秒杀一切 提交于 2019-11-28 11:25:16
How can I determine the ( ISO 8601 ) week number in a Windows batch file? Unfortunately WMIC PATH WIN32_LOCALTIME GET /FORMAT:LIST only has WeekInMonth ... I have found some very complex solutions . Is there no easier way? You can use Ritchie Lawrences's Date Functions. It is maintained on Gitub. https://ritchielawrence.github.io/batchfunctionlibrary/ Here is the code. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :DateToWeek %yy% %mm% %dd% yn cw dw :: :: By: Ritchie Lawrence, Updated 2002-11-20. Version 1.1 :: :: Func: Returns an ISO 8601 Week date from a

Get next/previous ISO week and year in PHP

自闭症网瘾萝莉.ら 提交于 2019-11-28 09:47:44
问题 I need a function that takes an ISO week and an ISO year as parameter and returns the next ISO week and year (and a function that returns the previous ISO week/year). 回答1: So answer for 4 day so i give it a shot: <?php // Start with Timstamp 0, else the seconds might be off $x = new DateTime("1970-01-01 00:00:00"); $x->setISODate(2010, 2); echo $x->format("Y-m-d H:i:s"); // 2010-01-11 00:00:00 $x->modify("+1 week"); echo $x->format("Y-m-d H:i:s"); // 2010-01-18 00:00:00 // Now for the next

Find weekly periods (starting on a Monday) for a month

牧云@^-^@ 提交于 2019-11-28 09:34:22
I'm trying to find the weekly periods for a given month and year. Dates should start on a Monday and end on a Sunday. If the 1st of the month is a Sunday (Ex May 2011), it should be the first element. May 2011 May 1 (Sunday) May 2 - May 8 (Monday - Sunday) May 9 - May 15 (Monday - Sunday) May 17 - Ma6y 22 (Monday - Sunday) May 23 - May 29 (Monday - Sunday) May 30 - May 31 (Monday - Tuesday) September 2012 September 1 - September 2 September 3 - September 9 September 10 - September 16 September 17 - September 23 September 24 - September 30 I am using this function to calculate the week numbers

Calculating the number of weeks in a year with Ruby

梦想的初衷 提交于 2019-11-27 19:23:59
问题 Is there a way in Ruby to calculate the number of weeks(ISO 8601) for a given year? I'm currently using a lookup table and I'd like to stop using it. 回答1: def num_weeks(year = Date.today.year) Date.new(year, 12, 28).cweek # magick date! end long_iso_years = (2000..2400).select{|year| num_weeks(year) == 53} Yields the same list as wikipedia 回答2: require 'date' def num_weeks(year = Date.today.year) # all years starting with Thursday, and leap years starting with Wednesday have 53 weeks # http:/

How to get year-sensitive calendar week ? date(“W”) gives back 52 for 1st of January

六月ゝ 毕业季﹏ 提交于 2019-11-27 15:11:33
问题 As the headline says, PHP's date("W") function gives back the calendar week (for the current day). Unfortunatly it gives back 52 or 53 for the first day(s) of most years. This is, in a simple thinking way, correct, but very annoying, as January 1st of 2012 is not calendar week 52, it's NOT a calendar week of the current year. Most calendars define this as week 0 or week 52 of the previous year. This is very tricky when you group each day of the year by their calendar week: 1st of January 2012

calculate the month from the year and week number in excel

北战南征 提交于 2019-11-27 11:21:54
问题 In Excel 2007 I have a Year number and Week number and I want to work out the Month number. The catch is that in my case the start of every week is a monday, so some weeks will overlap through the years. Examples: Year: 2012 Week 1 started: Monday 2nd January Sunday 1st January was in week 52 of 2011 So given the below: Year: 2011 Week: 10 How can I work out that week 10 started on 7th March and therefore week 10 was in Month number 3. Thanks for any help on this. 回答1: I suggest the following

How to get weeks starting on sunday?

浪子不回头ぞ 提交于 2019-11-27 06:56:02
问题 I need to get week number in php where week should be calculated from sunday. By default its from monday. Please help me to find a way how to get week number considering sunday as starting day. In php manual ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0) But I need to get week number of year, weeks starting on sunday. thanks 回答1: Try this: $week = intval(date('W')); if (date('w') == 0) { // 0 = Sunday $week++; } echo $week; Not sure if the logic is right though;

How can I determine the week number of a certain date?

廉价感情. 提交于 2019-11-27 05:05:03
I'm trying to make a calendar using wpf. By using itemsPanel and more, I have a grid with 7 columns(sunday-saturday) and 6 rows(week# of month). If i can find the starting position of the first of each month by getting the weekday and week number(of the month), how can I find the week number(0-5 of each month)? Also can't I somehow just fill in the calendar from there? I'm lost and I don't know what else to try. public partial class SchedulePage : Page { MainWindow _parentForm; public int dayofweek; public SchedulePage(MainWindow parentForm) { InitializeComponent(); _parentForm = parentForm; /

Find weekly periods (starting on a Monday) for a month

旧城冷巷雨未停 提交于 2019-11-27 03:00:33
问题 I'm trying to find the weekly periods for a given month and year. Dates should start on a Monday and end on a Sunday. If the 1st of the month is a Sunday (Ex May 2011), it should be the first element. May 2011 May 1 (Sunday) May 2 - May 8 (Monday - Sunday) May 9 - May 15 (Monday - Sunday) May 17 - Ma6y 22 (Monday - Sunday) May 23 - May 29 (Monday - Sunday) May 30 - May 31 (Monday - Tuesday) September 2012 September 1 - September 2 September 3 - September 9 September 10 - September 16

python - Week number of the month

一曲冷凌霜 提交于 2019-11-26 22:53:49
问题 Does python offer a way to easily get the current week of the month (1:4) ? 回答1: In order to use straight division, the day of month for the date you're looking at needs to be adjusted according to the position (within the week) of the first day of the month. So, if your month happens to start on a Monday (the first day of the week), you can just do division as suggested above. However, if the month starts on a Wednesday, you'll want to add 2 and then do the division. This is all encapsulated