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

How to get all weekends within a date range in C#

Is there a simple way or framework to get all weekends within a date range in C#? Is it possible to do with LINQ as well?
NoWar
  • 36,338
  • 80
  • 323
  • 498
6
votes
4 answers

Java - Get array of name of day for current week

What I am looking for is to create an array of the days of the week in java, starting from yesterday and go up to six days time as such String daysWeek[] = { "Yesterday", "Today", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}; The first…
ChrisAF
  • 63
  • 1
  • 3
5
votes
5 answers

How to get the 7 days in a week with a currentDate in javascript?

(first, sorry for my bad english, i'm a beginner) I have a chart of percent by date. I would like to display every day of the current week in the x-axis. So, i tried to find how to get the seven days of the week. that's what i have : var curr = new…
Gaelle
  • 614
  • 1
  • 7
  • 30
5
votes
2 answers

Java day of the week from string

I have this simple code: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = format.parse("2011-10-29"); calendar.setTime(date); Log.d("Debug","Day of the week = "+(calendar.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY)); The…
out_sid3r
  • 1,018
  • 2
  • 20
  • 42
5
votes
3 answers

How to histogram day-of-week, and have string labels

I have a data-frame of dates (Date object); see bottom. I'm trying to convert them to day-of-week and then draw a histogram, but ideally where the labels are 'Monday'...'Sunday' (not numeric) I have two distinct problems: It's easy to convert a…
smci
  • 32,567
  • 20
  • 113
  • 146
5
votes
4 answers

Get the days in a Week in Javascript, Week starts on Sunday

Here's the given input from the user: Year = 2011, Month = 3 (March), Week = 2 I want to get the days in week 2 of March 2011 in JavaScript. e.g. Sunday 6th, Monday 7th, Tuesday 8th, Wednesday 9th, Thursday 10th, Friday 11th, Saturday 12th Any…
drexsien
  • 882
  • 3
  • 12
  • 31
5
votes
3 answers

java.text.ParseException: Unparseable date : "..."

I get this error with this code: SimpleDateFormat sdf = new SimpleDateFormat("EEEE dd MMMM HH:mm yyyy",myDateFormatSymbols); sdf.parse("понеділок 12 квітень 07:00 2021"); Whis is "Monday 12 April 07:00 2021". The thing is, whenever I change the day…
5
votes
2 answers

How to get the current day in flutter?

I want to get the current day using dart. Code I want:- //I want something like this var day = DateTime.getCurrentDay(); Output:- Tuesday
the coder
  • 400
  • 1
  • 9
  • 17
5
votes
2 answers

List in localized order

We have the DayOfWeek enum defining the days of the week in standard ISO 8601 order. I want a List of those objects in the order appropriate to a Locale. We can easily determine the first day of the week for locale. Locale locale =…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
5
votes
1 answer

Calendar giving unexpected results for year 1

I tried to do this code-golf challenge in Java 7. Just for anyone that doesn't know: code-golf is to complete a certain task in as few bytes as possible. Obviously Java isn't a suitable programming language to do this in, especially with languages…
Kevin Cruijssen
  • 9,153
  • 9
  • 61
  • 135
5
votes
3 answers

Rails - Determine the day of the week

So DateTime.current returns Fri, 11 Mar 2016 19:34:10 +0000. How can I determine the day of the week. For example, if DateTime.current is Friday(just the day of the week, regardless of the date)? DateTime.current == DateTime.parse("Friday") Won't…
fardin
  • 1,399
  • 4
  • 16
  • 27
5
votes
3 answers

DAY_OF_WEEK always returns 7 in Java GregorianCalendar

So I want to do something with Java GregorianCalendar that seems to be going way harder than it should. I want to get the day of the week from the month and date. But it won't do that. I know that people often get the wrong answer to this because…
Displaced Hoser
  • 871
  • 3
  • 13
  • 35
5
votes
1 answer

What settings in Mac OS X affect the `Locale` and `Calendar` inside Java?

These two questions prompted me to wonder what settings in Mac OS X affect the Locale and Calendar defaults and behavior in Java: WEEK_OF_YEAR inconsistent on different machines Why would Calendar.getInstance() fail to use the default locale? Key…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
5
votes
4 answers

How to check if a certain date is a weekend taking into account the current locale in Java?

I'm writing a program in Java and I need to determine whether a certain date is weekend or not. However, I need to take into account that in various countries weekends fall on different days, e.g. in Israel it's Friday and Saturday wheras in some…
Bartek
  • 1,327
  • 1
  • 11
  • 22
5
votes
4 answers

Averaging daily data into weekly data

I am wondering if there is a way to average daily data into weekly data. The dataframe that I call CADaily looks like this: > CADaily[1:10, ] Climate_Division Date Rain 885 1 1948-07-01 0.8750000 …
Luciano Rodriguez
  • 719
  • 4
  • 9
  • 16