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

How to get localised day names in Delphi?

I'm using standard Delphi constants DayMonday, etc and I want to convert them to localized strings (eg "Lundi"). Is there a simple RTL or VCL call for this?
Roddy
  • 66,617
  • 42
  • 165
  • 277
8
votes
4 answers

Calendar giving wrong day of week

I have a calendar object as below that represents 08 Aug 2014.It is a Friday. So myCal.get(Calendar.DAY_OF_WEEK) should be 6. But it gives 2. Why is…
faizal
  • 3,497
  • 7
  • 37
  • 62
8
votes
10 answers

Convert string to day of week (not exact date)

I'm receiving a String which is a spelled out day of the week, e.g. Monday. Now I want to get the constant integer representation of that day, which is used in java.util.Calendar. Do I really have to do if(day.equalsIgnoreCase("Monday")){...}else…
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
8
votes
2 answers

Select current week using LINQ

How do I write the where statement that select records with Date field between Sunday to Saturday of a given date. Data Fields: Id, Name, Date
bigNoob
7
votes
3 answers

Math with Enums (e.g. DayOfWeek) in C#

Why is it that the following code won't work: endDate.AddDays(7-endDate.DayOfWeek); While this will: endDate.AddDays(0-endDate.DayOfWeek + 7); ? (By "won't work" I mean results in the following compilation error: "cannot convert from…
nicolaskruchten
  • 26,384
  • 8
  • 83
  • 101
7
votes
8 answers

getDay() method to return day of the week for a given date not works

I'm trying to complete the task named Java Date and Time on HackerRank. Task You are given a date. You just need to write the method, getDay, which returns the day on that date.For example, if you are given the date, August 14th 2017, the…
Said
  • 187
  • 1
  • 2
  • 11
7
votes
4 answers

Getting the Date and numeric weekday in PHP

i'm developing an application in PHP and I need to use dates and the numeric representation of weekdays. I've tried the following: $today = date("Y-m-d"); $number = date('N', strtotime($today)); echo "Today: " . $today . " weekday: " . $number .…
Edoardo
  • 599
  • 2
  • 9
  • 26
7
votes
4 answers

Equivalent of WeekDay Function of VB6 in C#

In VB6 code, I have the following: dim I as Long I = Weekday(Now, vbFriday) I want the equivalent in C#. Can any one help?
RBS
  • 3,801
  • 11
  • 35
  • 33
7
votes
7 answers

A more condensed way of doing the following loop?

I have the following for-loop. It uses the values 0-6 form monday-sunday respectively. Is there a more condensed way to do this? As opposed to listing out the if ($i=="day") // $i = 0 is monday... $i = 6 is Sunday for($i=0;$i<7;$i++){ if…
kylex
  • 14,178
  • 33
  • 114
  • 175
7
votes
3 answers

Find week of a year given the date in mm/dd/yyyy

I am trying to find the week that a date falls in, in a certain year. I have a bunch of files that need to be sorted into folders like "week1-2012" and "week34-2011". I tried searching but a lot of the results aren't really helping because I am…
imakeitrayne
  • 155
  • 1
  • 2
  • 11
6
votes
3 answers

BigQuery Standart SQL: extract day-of-week name from timestamp

I'm Using BigQuery Standart SQL. I need to convert a timestamp to Day-of-week name. e.g. convert today's timestamp (2016-11-24 00:00:00) into a string: 'Thursday' Thanks :)
shayms8
  • 671
  • 6
  • 13
  • 28
6
votes
4 answers

LINQ to Entities Join on DateTime.DayOfWeek

Imagine two tables: Shifts, RANK_S_DAY. Shifts contains a ShiftDate column which is DateTime and RANK_S_DAY has a DayOfWeek column. I need to join (int)ShiftDate.DayOfWeek equals DayOfWeek. I understand why it won't work, but I'm not quite sure…
Steve
  • 4,463
  • 1
  • 19
  • 24
6
votes
5 answers

DayOfWeek get the next DayOfWeek(Monday,Tuesday...Sunday)

Is there a way to summarize this code into 1-2 lines? My goal is to return, for example, I have a DayOfWeek which is Monday, I want to get the day after that (Tuesday) or n days after that. switch (_RESETDAY) { case…
Katherine
  • 319
  • 1
  • 4
  • 15
6
votes
1 answer

parsing date from day of week with java datetimeformatter

I'm parsing text from an sms service using a java program, and I see that when using DateTimeFormatter 'E' or 'e' are the pattern characters for days of the week, and that the number of chars determines type of format (i.e. 'E' = T, 'EE' = Tu, 'EEE'…
Mercutio
  • 1,152
  • 1
  • 14
  • 33
6
votes
4 answers

C#: Finding Out Which Monday Is The 3rd Monday Of The Month?

If I'm writing some C# code that runs through a year of dates (iterating by day) and want something special to happen every 3rd Monday of the month, how can I accomplish this? In other words, what is the best way to find which Monday of the month a…
sooprise
  • 22,657
  • 67
  • 188
  • 276