Questions tagged [weekday]

A day of the week. Used for questions related to programming problems that involve `weekday`: calculation, triggering an event, discovery of a specific day etc

462 questions
890
votes
31 answers

How do I get the day of week given a date?

I want to find out the following: given a date (datetime object), what is the corresponding day of the week? For instance, Sunday is the first day, Monday: second day.. and so on And then if the input is something like today's date. Example >>>…
frazman
  • 32,081
  • 75
  • 184
  • 269
59
votes
8 answers

Start of week for locale using Joda-Time

How do you determine which day of the week is considered the “start” according to a given Locale using Joda-Time? Point: Most countries use the international standard Monday as first day of week (!). A bunch others use Sunday (notably USA). Others…
stolsvik
  • 5,253
  • 7
  • 43
  • 52
44
votes
17 answers

NSCalendar first day of week

Does anyone know if there is a way to set the first day of the week on a NSCalendar, or is there a calendar that already has Monday as the first day of the week, instead of Sunday. I'm currently working on an app that is based around a week's worth…
Joshua
  • 839
  • 4
  • 12
  • 15
42
votes
8 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
  • 34,062
  • 40
  • 136
  • 186
39
votes
6 answers

Get next date from weekday in JavaScript

How can one return the next date of a given weekday (it could be either a number 0-6 or names Sunday-Saturday). Example, if today, on Friday 16-Oct-2009 I passed in: Friday, it would return today's date 16-Oct-2009 Saturday returns…
Ruslan
  • 9,927
  • 15
  • 55
  • 89
23
votes
7 answers

Get weekdays in English in R

I am using R outside the US and I got everything working in English, but the result of weekdays() is still in Spanish: Day <- seq(as.Date("2013-06-01"), by=1, len=30) weekdays(Day) [1] "sábado" "domingo" "lunes" "martes" "miércoles" …
Renne007
  • 1,087
  • 2
  • 10
  • 13
23
votes
4 answers

Previous weekday in Python

In Python, given a date, how do I find the preceding weekday? (Weekdays are Mon to Fri. I don't care about holidays)
Lobert
  • 467
  • 1
  • 4
  • 10
21
votes
2 answers

How to add number of days to a date, consider only business days (i.e. ignore weekends)?

I'm trying to create a formula to calculate the n-th Business Date (only Monday to Friday are business days). For simplicity's sake, holidays are not important; only weekends should be ignored. For example: …
E.Z.
  • 6,393
  • 11
  • 42
  • 69
16
votes
8 answers

c++ day of week for given date

I am trying to write a simple program in c++ that returns the day of the week for a given date. The input format is day, month, year. I cannot get it to work with leap years. I tried subtracting one from the a variable when the input year is a leap…
OerllydSaethwr
  • 169
  • 1
  • 1
  • 4
16
votes
5 answers

How to get the day of the week from a Unix timestamp (PHP)?

How do I get the day (1-7) from a Unix timestamp in PHP? I also need the day date (1-31) and month (1-12).
horgen
  • 2,183
  • 10
  • 30
  • 34
15
votes
4 answers

Num day to Name day with Pandas

If I use this funtion pd.DatetimeIndex(dfTrain['datetime']).weekday I get number of the day, but I don't find any function which give the name of de day... So I need to convert 0 to Monday, 1 to Tuestday and so on. Here is an example of my…
Yari
  • 867
  • 3
  • 9
  • 13
14
votes
12 answers

Return a list of weekdays, starting with given weekday

My task is to define a function weekdays(weekday) that returns a list of weekdays, starting with the given weekday. It should work like this: >>> weekdays('Wednesday') ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday'] So…
Gusto
  • 1,483
  • 9
  • 23
  • 34
14
votes
2 answers

Swift - Weekday by current location by currentCalendar()

Today is Wednesday and I have this code let calendar:NSCalendar = NSCalendar.currentCalendar() let dateComps:NSDateComponents = calendar.components(.CalendarUnitWeekday , fromDate: NSDate()) let dayOfWeek:Int = dateComps.weekday dayOfWeek is 4, but…
Bogdan Bogdanov
  • 882
  • 11
  • 36
  • 79
13
votes
2 answers

Generate series of week intervals for given month

In a Postgres 9.1 database, I am trying to generate a series of weeks for a given month but with some constraints. I need all weeks to start on Monday and get cut when they start or end in another month. Example: For February, 2013 I want to…
Eddie
  • 302
  • 1
  • 2
  • 8
12
votes
7 answers

How to check if current time falls within a specific range on a week day using jquery/javascript?

When a user visits a page I need to check if the current time falls between 9:00 am and 5:30pm on a weekday and display something using jquery/javascript.But I am not sure how can check that. Could someone please help? Thanks
kranthi
  • 1,519
  • 6
  • 29
  • 52
1
2 3
30 31