dayofweek

Get day from DateTime using C#

Hi. Silly question. Given a date in a datetime and I know it's tuesday for instance how do i know its tue=2 and mon=1 etc... Thanks ...

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 ($i==0) echo ' <input name="repeat_on_week[]" type="checkbox" value="0" /> Monday'; ...

C#: Set initial DayOfWeek as Monday not Sunday

Hello, Is there a way to set the first DayOfWeek as Monday = 0 not Sunday? (int)dateList[0].DayOfWeek == 0) // 0 = Sunday ...

another strange behaviour with GregorianCalendar

Hello everybody, Take a look at the piece of code bellow: Calendar today1 = Calendar.getInstance(); today1.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); System.out.println(today1.getTime()); Calendar today2 = new GregorianCalendar(2010, Calendar.JULY, 14); today2.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); System.out.println(today2.getT...

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 GetNthWeekofMonth(DateTime date, int nthWeek, DayOfWeek dayofWeek) { //return the date of nth week of ...

mysql: which the better one use DAY() or WEEK()?

I have a web task for counting some data inside DB. I must count this data daily, weekly, and monthly. For weekly, I am still confused to decide which MySQL syntax I should use for this case. There are two suggestions to resolve this problem: using DAY() or WEEK(). I want this syntax is not limited by a confusing thing. As should decl...

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! ...

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 = InBetweenDaysInclusive(new DateTime(2010, 10, 23), D...