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
12
votes
3 answers

How to get DayOfWeek from an Instant.now()

Assuming the following code... Instant x = Instant.now(); How do I get day of week from x?
barrypicker
  • 9,740
  • 11
  • 65
  • 79
12
votes
4 answers

get nth weekday of month in C#

Possible Duplicate: How do I determine if a given date is Nth weekday of the month? How do i get the nth weekday of the month? For ex.: 2nd Monday of "July 2010" = 07/12/2010. Looking for a function like: public DateTime…
Prasad
  • 58,881
  • 64
  • 151
  • 199
12
votes
7 answers

How to find nearest day of week in php?

How to find a speciefic nearest day of the week in PHP if initially I have a date string like: 07.05.2010? For example, I want to find the nearest Sunday (or any day of the week). How can I implement this? Thanks
moogeek
  • 397
  • 4
  • 14
  • 34
12
votes
6 answers

$week function and first day of week in aggregation

I use $project operator to extract week part from Date, then do grouping by weeks in aggregation pipeline: { $project: { year: { $year: [ "$datetime" ] }, week: { $week: [ "$datetime" ] }, .... } }, .... { $group: { _id: { …
11
votes
5 answers

Getting the start and the end date of a week using java calendar class

I want to get the last and the first week of a week for a given date. e.g if the date is 12th October 2011 then I need the dates 10th October 2011 (as the starting date of the week) and 16th october 2011 (as the end date of the week) Does anyone…
user421607
  • 175
  • 2
  • 4
  • 12
11
votes
2 answers

GregorianCalendar setFirstDayOfWeek not affecting WEEK_OF_YEAR on pre Nougat

The code below gives a different result on Nougat and pre-Nougat. Take a look and try it yourself if you want. I would appreciate it if someone could explain me why and give a solution. I want the correct WEEK_OF_YEAR value, dependent on the first…
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
11
votes
6 answers

How to test if a DateTime is between 2 days of week (DayOfWeek)

In C#, given an arbitrary set of DayOfWeek end points (like, DayOfWeek.Friday and DayOfWeek.Sunday) how would one test if an arbitrary date falls between those two days, inclusive? Example: // result == true; Oct 23, 2010 is a Saturday var result =…
russcollier
  • 709
  • 1
  • 9
  • 18
11
votes
5 answers

How to get the weekday from day of month using pyspark

I have a dataframe log_df: I generate a new dataframe based on the following code: from pyspark.sql.functions import split, regexp_extract split_log_df = log_df.select(regexp_extract('value', r'^([^\s]+\s)', 1).alias('host'), …
mdivk
  • 3,545
  • 8
  • 53
  • 91
11
votes
2 answers

Is there a single character day of the week convention?

Is there a single character convention for the days of the week in English (or programmer-specific) and if so what is it? I realize this could be an English language question but I think it has special significance for programmers. Maybe something…
User
  • 62,498
  • 72
  • 186
  • 247
10
votes
3 answers

Looping through the days of the week inside of C# TimeSpan Class

I'm trying to loop through EACH DAYof the WEEK between 2 time periods DateTime start = new DateTime(2010, 1, 1); DateTime end = new DateTime(2011, 12, 12); I have managed to get the number of days between these dates using the following code …
Calibre2010
  • 3,729
  • 9
  • 25
  • 35
10
votes
6 answers

Converting DayOfWeek enum to a string repesenting the day

I was wondering if there was a way to directly convert the integer DayOfWeek returns into a string representing the day like Monday, Tuesday etc. Sample code: MessageBox.Show(Date.Today.DayOfWeek) This will return 6 (as of today). Is there a way to…
James
  • 139
  • 2
  • 3
  • 7
10
votes
2 answers

Best way to generate day-of-week boxplots from a Pandas timeseries

i am trying to create a set of day-of-week boxplots for a timeseries (e.g. 5-minute temperature observations). My code: # ts is our timeseries ts = df.SomeColumn dow_map = {} days = ['MON','TUE','WED','THU','FRI','SAT','SUN'] dow_idx =…
dkanoafry
  • 103
  • 1
  • 4
9
votes
2 answers

Order of Java 8's datetime package DayOfWeek enum

I was looking at the tutorial for Java 8's new datetime package. On the page about the DayOfWeek and Month enums, it said that the DayOfMonth enum runs from Monday to Sunday. Why is that? Every other system I've used (including .NET) has the week…
chama
  • 5,973
  • 14
  • 61
  • 77
9
votes
3 answers

In .net, knowing the week number how can I get the weekdays date?

I want to create a function in C# which for a week number will return me the days, in that week. For instance for week number 40, how can I get the days: 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, 10/10. Thank you in advance!
user171910
9
votes
6 answers

Best way to store weekly event in MySQL?

I have a table of weekly events that run on certain days of the week (e.g. MTWTh, MWF, etc.) and run on a certain time (e.g. 8am-5pm). What's the best way to store day of week information in MySQL to make retrieving and working with the data…
erjiang
  • 44,417
  • 10
  • 64
  • 100
1 2
3
45 46