Count number of Mondays in a given date range
Given a date range, I need to know how many Mondays (or Tuesdays, Wednesdays, etc) are in that range. I am currently working in C#. ...
Given a date range, I need to know how many Mondays (or Tuesdays, Wednesdays, etc) are in that range. I am currently working in C#. ...
I have a textbox with the Text property bound to a dataset column with the DataType set to System.DateTime. The FormatString on the Binding is set to dd-MM-yyyy. When the user enters a date it attempts to convert it to a date but can come up with some strange values for a seemingly invalid date. For example: textBox1.Text = "01-02-200...
As the title says really. There is this example code, but then it starts talking about millisecond / nanosecond problems. http://blogs.msdn.com/brada/archive/2004/03/20/93332.aspx Edit: This is what I've got so far: public Double CreatedEpoch { get { DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLoca...
I have a variable last_login and want to output a message if the last login was yesterday, today or elsewise output the date. The last two cases are clear but how can I check if a given date in classic asp was yesterday? I'm blockheaded right now... ...
I have a very simple ASP.Net page that acts as a front end for a stored procedure. It just runs the procedure and shows the output using a gridview control: less than 40 lines of total code, including aspx markup. The stored procedure itself is very... volatile. It's used for a number of purposes and the output format changes regularl...
How can I convert a varchar field of the form YYYYMMDD to a datetime in T-SQL? Thank you. ...
What commands in Emacs can I use to insert into the text buffer of a file the current date and time? (For example, the equivalent in Notepad is simply pressing F5 which is about the only useful feature for Notepad!) ...
Hi, Does anyone know of a simple method for solving this? I have a table which consists of start times for events and the associated durations. I need to be able to split the event durations into thirty minute intervals. So for example if an event starts at 10:45:00 and the duration is 00:17:00 then the returned set should allocate 15 ...
What format do I use for Date/Time when writing to an XML file using .NET? Do I simply use DateTime.ToString(), or do I have to use a specific format? ...
How do I convert a datetime or date object into a POSIX timestamp in python? There are methods to create a datetime object out of a timestamp, but I don't seem to find any obvious ways to do the operation the opposite way. ...
I am having problems converting a string in the format "yyyy-MM-ddZ" using VB.net. For example I have the string "2007-10-21Z". Using CDate or TryParse it comes out to 10/20/2007 instead of 10/21/2007. I'm not understanding how the Z affects the date string so that when it is parsed it results in the day before. From what I understan...
The event returns a standardized timestamp in the format of "Sat Oct 25 21:55:29 +0000 2008" How can I compare this with the current time in PHP so that it gives me the result in a form like "It has been 15 minutes!" or "It has been three days!" Also, how can I get the current time? ...
On my blog, I display in the right nav the 10 most popular articles in terms of page hits. Here's how I get that: SELECT * FROM entries WHERE is_published = 1 ORDER BY hits DESC, created DESC LIMIT 10 What I would like to do is show the top 10 in terms of page hits per day. I'm using MySQL. Is there a way I can do this in the database...
I recently switched my hosting provider and due to the time zone that the server is now in, my code has stopped working. The hosting server reports in Pacific time, However, my code needs to work with GMT as my site is for the UK market. So, all my displays and searches need to be in the format dd/MM/yyyy How can I account for the dif...
We've got a scheduling application running that calls a WCF service to run nightly jobs. A large number of these include information about the current business date. For business reasons the scheduling server is set to GMT, but our service is running on servers set to NY time. This raises a problem; the dates are being passed to our...
In a tightly looped test application that prints out the value of DateTime.UtcNow.Ticks, I notice that the value will jump a remarkable amount once every hour or so. Look closely at the following sample data: 1:52:14.312 PM - 633614215343125000 1:52:14.359 PM - 633614215343593750 1:52:14.421 PM - 633614215344218750 1:52:14.468 PM - 633...
A few months ago I was introduced to the new DateTimeOffset type and was glad DateTime's flaws with regard to time zones were finally taken care of. However, I was left wondering if there were any overhead or problems that could occur from using this new type. I work on a multi-locale web application. Does anyone know of anything that ...
How would I format the standard RSS pubDate string as something closer to ASP.NET's DateTime? So, from this: Wed, 29 Oct 2008 14:14:48 +0000 to this: 10/29/2008 2:14 PM ...
Jeff wrote about getting a file version/datestamp a while back. Visual studio doesn't increment builds unless you close/reopen the solution, so grabbing the timestamp seems to be the best way to verify what build you are using. I ported the solution to C# // from http://www.codinghorror.com/blog/archives/000264.html protected D...
I need to do a date comparison in Mysql without taking into account the time component i.e. i need to convert '2008-11-05 14:30:00' to '2008-11-05' Currently i am doing this: SELECT from_days(to_days(my_date)) Is there a proper way of doing this? ...