Questions tagged [dayofweek]

Usually a function that returns day of the week when a certain date object is passed.

Get day of day of the week in:

691 questions
2
votes
3 answers

Grouping a list of days of week into groups of consecutive days

I am using C# to create a function that takes in a list of NodaTime.IsoDayOfWeek days. I want to group the input into groups of consecutive days. For example, the following lists should give the following output: { Mon, Tue } => { { Mon, Tue } } {…
08Dc91wk
  • 4,254
  • 8
  • 34
  • 67
2
votes
1 answer

How to get previous Thursday, inclusive?

Suppose that today is Thursday, June 30, 2016. Then date +%Y%m%d is 20160630, date -d'last-thursday' +%Y%m%d is 20160623, and date -d'next-thursday' +%Y%m%d is 20160707. However, date -d'last-wednesday' +%Y%m%d is 20160629, and date…
cshin9
  • 1,440
  • 5
  • 20
  • 33
2
votes
1 answer

Project Euler 19: Counting Sundays, Java

I'm using the Calendar API of Java to calculate the total number of sundays which fall on the first day of every month. The Following code gives me 1 extra days for the specified starting date and ending date of date format (Year/Month/Date).…
Batman25663
  • 272
  • 1
  • 3
  • 12
2
votes
1 answer

How can I add weeks in R?

I have a variable that represents the week of the year (1-53) and I'd like to create new week variables by both adding to and subtracting weeks from it in a way that makes sense given a calendar year. If I use week + 4, and week = 52, I get…
c. garrett
  • 69
  • 2
  • 4
2
votes
1 answer

How to find documents in all mondays from last 7 weeks in mongodb

{ "_id" : ObjectId("568b650543712795bf864a45") "companyId" : "55e2d7cfdc8f74d14f5c900f", "timeStamp" : ISODate("2014-12-02T18:30:00.000Z") }, { "_id" : ObjectId("568b650543712795bf864a46") "companyId" :…
Midhun Sudhakar
  • 1,238
  • 2
  • 10
  • 14
2
votes
1 answer

Start and End times of the week

I have this string that represents start time (in seconds from Midnight) and duration (in seconds) from Sunday to Saturday. 0 0 79200 21600 36000 18000 0 0 21600 43200 0 0 0 0 Broken down 0 0 means no start or end on Sunday 79200 21600 means start…
2
votes
2 answers

How to find all Mondays in two date ranges

I and trying to get a list of all Monday dates within a range of dates the use inputs. I have got most of it working just haven't been able to figure out the for next loop on how I can add the Mondays between start date and end date and put them…
2
votes
4 answers

How to get the Date of the first day of a week given a time stamp in Hadoop Hive?

Besides writing a custom UDF to support this issue, is there any known methods of achieving this? I'm currently using Hive 0.13.
Boris Ka
  • 79
  • 1
  • 1
  • 8
2
votes
2 answers

How can I get yesterday without calling moment twice?

I can get the moment object for yesterday by calling var yesterday = moment().day(moment.day()-1); But this requires me to call moment twice, and that bugs me. Is there a way to achieve the same end using moment's API only once?
David says Reinstate Monica
  • 19,209
  • 22
  • 79
  • 122
2
votes
2 answers

How to find the day of the week `tm_wday` from a given date?

To find the day (number) for a given date, I wrote below code using : tm time {ANY_SECOND, ANY_MINUTE, ANY_HOUR, 21, 7, 2015 - 1900}; mktime(&time); // today's date PRINT(time.tm_wday); // prints…
iammilind
  • 68,093
  • 33
  • 169
  • 336
2
votes
2 answers

How do Properties actually work in C#, for example DateTime.Today?

I just saw some snippet code using the struct DateTime.Today and I can't understand the inner workings of it. Here is the specific line: if (DateTime.Today.DayOfWeek == DayOfWeek.Monday) After using Go To Definition F12, I saw that the Today static…
3rdWorldCitizen
  • 264
  • 2
  • 5
2
votes
1 answer

Python: Define starting day in week definition in isocalendar or strftime or else

I need to partition pandas.tslib.Timestamp into weeks. So, given that a is a pd.DataFrame I used tmp = pd.to_datetime(a) tmp = tmp.apply(lambda x: str(str(x.isocalendar()[1])) The problem is that my week starts not on Monday or Sunday but…
user3861925
  • 713
  • 2
  • 10
  • 24
2
votes
3 answers

How to Convert Bit String to Boolean Array

In VB or C#, is there a concise way (no looping) to convert a string to a boolean array? I have a string of binary values representing days of the week ("0001100") and wish to convert to a boolean array (false, false, false, true, true, false,…
BSalita
  • 8,420
  • 10
  • 51
  • 68
2
votes
0 answers

How to create a composite primary key with fluent api that contains a DayOfWeek column?

In my model I have a detail table that will contain data for each day of the week, so it has this definition: public class JournalDay { public int JournalID { get; set; } public DayOfWeek Day { get; set; } public TimeSpan From { get;…
Manuel Castro
  • 2,460
  • 1
  • 19
  • 14
2
votes
2 answers

Issue with getting batch script to print keeps given a error about set was unexpected at this time

Okay I am trying to get the script to print the day of the week and after the test would like to get the script to go more advanced once i get it working correctly @echo off SETLOCAL enabledelayedexpansion SET /a count=0 FOR /F "skip=1" %%D IN…
raziel23x
  • 71
  • 1
  • 8