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:

599 questions
134
votes
14 answers

How to get the day of week and the month of the year?

I don't know much about Javascript, and the other questions I found are related to operations on dates, not only getting the information as I need it. Objective I wish to get the date as below-formatted: Printed on Thursday, 27 January 2011 at…
Will Marcouiller
  • 22,531
  • 19
  • 89
  • 142
117
votes
9 answers

How to get the integer value of day of week

How do I get the day of a week in integer format? I know ToString will return only a string. DateTime ClockInfoFromSystem = DateTime.Now; int day1; string day2; day1= ClockInfoFromSystem.DayOfWeek.ToString(); /// it is not working day2=…
akshaykumar6
  • 1,967
  • 3
  • 16
  • 31
97
votes
7 answers

How to group by week in MySQL?

Oracle's table server offers a built-in function, TRUNC(timestamp,'DY'). This function converts any timestamp to midnight on the previous Sunday. What's the best way to do this in MySQL? Oracle also offers TRUNC(timestamp,'MM') to convert a…
O. Jones
  • 81,279
  • 15
  • 96
  • 133
72
votes
3 answers

How to get the week day name from a date?

Given 03/09/1982 how can we say it is which week day. In this case it will be Tue. Is it possible to get in a single query?
user1025901
  • 1,679
  • 4
  • 19
  • 27
63
votes
4 answers

Correctness of Sakamoto's algorithm to find the day of week

I am using Sakamoto's algorithm to find out the day of week from a given date. Can anybody tell me the correctness of this algorithm? I just want this from 2000 to 2099. The algorithm from Wikipedia is given for reference. int dow(int y, int m, int…
Harikrishnan
  • 3,361
  • 3
  • 39
  • 70
58
votes
4 answers

Get weekday/day-of-week for Datetime column of DataFrame

I have a DataFrame df like the following (excerpt, 'Timestamp' are the index): Timestamp Value 2012-06-01 00:00:00 100 2012-06-01 00:15:00 150 2012-06-01 00:30:00 120 2012-06-01 01:00:00 220 2012-06-01 01:15:00 …
EP1986
  • 693
  • 1
  • 5
  • 12
40
votes
6 answers

Android Calendar get current day of week as string

i tried to get a string with the name of the actual weekday this way: Calendar c = Calendar.getInstance(); int dayOfWeek = c.get(Calendar.DAY_OF_WEEK); if (c.get(Calendar.MONDAY) == dayOfWeek) weekDay =…
ntm
  • 684
  • 2
  • 10
  • 32
35
votes
1 answer

C# Cultures: Localize DayOfWeek?

How do I localize a DayOfWeek other than today? The following works just fine for the current day: DateTime.Now.ToString("dddd", new CultureInfo("it-IT")); But how can I localize all days of the week?? Edit: A possible (and probably very, very…
bevacqua
  • 43,414
  • 51
  • 157
  • 277
35
votes
7 answers

How to get localized short day-in-week name (Mo/Tu/We/Th...)

Can I get localized short day-in-week name (Mo/Tu/We/Th/Fr/Sa/Su for English) in Java?
fhucho
  • 31,862
  • 40
  • 125
  • 178
31
votes
4 answers

Generate date from week number in moment.js

As mentioned in the title, I have a week number and a year value. Is there a way of finding Monday of that week using moment.js? Was trying, but not succeeded
Bartosz
  • 4,192
  • 9
  • 40
  • 66
31
votes
7 answers

In Java, how to get strings of days of week (Sun, Mon, ..., Sat) with system's default Locale (language)

The simplest way: String[] namesOfDays = new String[7] { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" }; This method does not use Locale. Therefore, if the system's language is not English, this method does not work properly. Using Joda…
Naetmul
  • 11,923
  • 6
  • 46
  • 72
28
votes
9 answers

Retrieve current week's Monday's date

We have a utility that will run any day between Monday - Friday. It will update some number of files inside a Content Management Tool. The last modified date associated with that file should be, that week's monday's date. I wrote the following…
Shashank Kadne
  • 7,539
  • 5
  • 38
  • 53
28
votes
6 answers

Get the Day of a week from integer value of the Day

I have converted several days of the week to their respective integer values.. For example: Tuesday, Thursday, Friday As 2,4,5 Now I need to get back to the days from the integers. Simply the inverse of what i had done. Inverse of the Question: Get…
parkourkarthik
  • 571
  • 1
  • 6
  • 18
23
votes
7 answers

Get current week start and end date in Java - (MONDAY TO SUNDAY)

Today is 2014-04-06 (Sunday). The output I get from using the code below is: Start Date = 2014-04-07 End Date = 2014-04-13 This is the output I would like to get instead: Start Date = 2014-03-31 End Date = 2014-04-06 How can I achieve this? This…
Scorpion
  • 6,447
  • 14
  • 72
  • 114
22
votes
1 answer

DateTime.DayOfWeek micro optimization

First of all: I'm asking this question just for fun and eager to learn. I have to admit I love to mess around with micro-optimizations (Although they have never led to any significant increase in speed in any of my developments). The…
rpax
  • 4,306
  • 6
  • 29
  • 53
1
2 3
39 40