dayofweek

Equivalent of WeekDay Function of VB6 in C#

I have to convert some of my VB6 Code to C# , In my VB6 I am having code like dim I as Long I = Weekday(Now, vbFriday) I want equivalent of the same in C# Can any one Help ? ...

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

Convert integer to a list of week days

I have an integer stored in a database (SQLAgent Frequency Interval) This integer is actually the sum of the selected days of the week that the schedule is to run The possible values are any combination of these values Sunday =1 Monday = 2 Tuesday =4 Wednesday= 8 Thursday = 16 Friday = 32 Saturday =64 ex 65 means that the schedul...

Getting number of certain days-of-the-week (weekend) from interval in PostgreSQL.

Given 2 timestamps in postgres, how do you calculate the time difference without counting whole Saturdays and Sundays? OR How do you count the number of Saturdays and Sundays in a given time interval? ...

DateTime Object Representing Day of Week

How can I convert a number between 1 and 7 into a DateTime object in C# which represents the day of the week? The numbers are coming from a XML file which I am parsing. I am retrieving each instance of a field containing a number between 1 and 7 which represents a day of the week between Sunday and Saturday. ...

Get string representation of a sql DateTime day

Hi all, Let's say i have a sql datetime of '1 May 2009' or '12 May 2009'. Is there any built in sql function / operation i can perform on the dates above to return the string representation of the DAY of the date? So for '1 May 2009' i'll get "Friday" as the answer (case not important). For '12 May 2009' i'll get "Tuesday". ...

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 'System.DayOfWeek' to 'double'") ...

Order by day_of_week in MySQL

How can I order the mysql result by varchar column that contains day of week name? Note that MONDAY should goes first, not SUNDAY. ...

Need a list of week days with their number on iphone os

I'm working on a project that needs to have a list of weekdays. I could get their locale names using the NSDateFormatter without a problem, but I was hoping to have an integer weekday also to save on the database and do some work. Where can i get that number? Thanks, Leonardo ...

sql between for DAYSOFWEEK

I have a generalized search where I'm looking up average prices for the various days of the week. The problem is I'm not sure how to ask for an odd range. 1-7 works fine, (monday-sunday), but if the user passes a sunday to a tuesday... ie 7-2 it doesn't work. 1-7 (1,2,3,4,5,6,7) 7-2 (7,1,2) etc. How else can I pass a range that is m...

How to get first day of a given week number in Java

Let me explain myself. By knowing the week number and the year of a date: Date curr = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(curr); int nweek = cal.WEEK_OF_YEAR; int year = cal.YEAR; But now I don't know how to get the date of the first day of that week. I've been looking in Calendar, Date, DateFormat but nothi...

Converting DayOfWeek enum to a string repesenting the day

I was wondering if there was a way to directly convert the integer DayOfWeek returns into a string representing the day like Monday, Tuesday etc. Sample code: MessageBox.Show(Date.Today.DayOfWeek) This will return 6 (as of today). Is there a way to directly convert this into Saturday, for example? I don't really care what it really c...

Find date for same day of the week last year?

OK so for example, today is Tuesday, Feb 02. Well the equivalent "Tuesday" from last year was on Feb 03. How can I find this out programmatically? Thanks!! ...

How can I pick from two ranges of dates with datepicker in jQuery?

I am using the jQuery Datepicker(http://keith-wood.name/datepick.html). I am trying to let the user pick a date from two separate ranges of days. I can't find that feature in the documentation and I would like to know how to make that possible. I want to let the user pick from 1-5 days after the current date. I also don't want to allow ...

Looping through the days of the week inside of C# TimeSpan Class

Hi, I'm trying to loop through EACH DAYof the WEEK between 2 time periods DateTime start = new DateTime(2010, 1, 1); DateTime end = new DateTime(2011, 12, 12); I have managed to get the number of days between these dates using the following code TimeSpan range = (end - start); turn out to be 710. I am now looking to get ...

Grouping Months of a particular Time span together using DateTime.

public static string TimeLine2(this HtmlHelper helper, string myString2) { StringBuilder myString3 = new StringBuilder(); DateTime start = new DateTime(2010, 1, 1); DateTime end = new DateTime(2011, 12, 12); myString3.Append("<table>"); myString3.Append("<tr>"); for (DateTime date = start; date <= end;...

How to find nearest day of week in php?

Hello! How to find a speciefic nearest day of the week in PHP if initially I have a date string like: 07.05.2010? For example, I want to find the nearest Sunday (or any day of the week). How can I implement this? Thanks ...

mysql :ordering table with day names

Hi.I am trying to get day of names with and correct order like Monday ,Tuesday.. But in my table I have records that after Monday comes Friday or I have Thursday between two Tuesday .I want to order them like Monday ,Monday ,Tuesday ,Tuesday, Wednesday so on .But I don`t want to group them. I used this query but it does not make ...

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 current Monday is? ...

Best way to store weekly event in MySQL?

I have a table of weekly events that run on certain days of the week (e.g. MTWTh, MWF, etc.) and run on a certain time (e.g. 8am-5pm). What's the best way to store day of week information in MySQL to make retrieving and working with the data easiest? My CakePHP app is going to need to retrieve all events happening NOW(). For time of d...