month

Unix gettimeofday() - compatible algorithm for determining week within month?

If I've got a time_t value from gettimeofday() or compatible in a Unix environment (e.g., Linux, BSD), is there a compact algorithm available that would be able to tell me the corresponding week number within the month? Ideally the return value would work in similar to the way %W behaves in strftime() , except giving the week within the...

Convert Month Number to Month Name Function in SQL

Hi, I have months stored in SQL Server as 1,2,3,4,...12. I would like to display them as January,February etc. Is there a function in SQL Server like MonthName(1) = January? I am trying to avoid a CASE statement, if possible. Thanks Edit ~ I am on SQL Server 2005, if this makes a difference. ...

What is the easiest or most effective way to convert month's abbreviation to a number in Perl? (ie "jan" to 1)

If I import a library to use a method, would it be worth it? Does importing take up a lot of memory? ...

Creating a Backpack-like Calendar in Rails

What are the current best practices in the Rails world for displaying a calendar month view with event items bound to the days in the month (like in Backpack or Google Calendar, for example)? I don't need anything like fancy stuff like drag and drop support. I'm just looking for code to let me get a list of events in my controller and ...

How to parse a month name (string) to an integer for comparison in C#?

I need to be able to compare some month names I have in an array. It would be nice if there were some direct way like: Month.toInt("January") > Month.toInt("May") My Google searching seems to suggest the only way is to write your own method, but this seems like a common enough problem that I would think it would have been already imp...

Javascript Date: next month

I've been using Javascript's Date for a project, but noticed today that my code that previously worked is no longer working correctly. Instead of producing Feb as expected, the code below produces March. My code looks something like this: current = new Date(); current.setMonth(current.getMonth()+1); //If today is Jan, expect it to be...

Propel - SQL: extract a month from a date

I'm trying to build a query with propel Criteria to get all Foo's in a given month. For example I want all Foo's in March. In regular SQL I would build a query like this: SELECT * FROM FooPeer WHERE MONTH(startDate) = 3 Any Idea how I can implement the "MySQL Month-function within a Criteria Object" ? $c = new Criteria(); $c -> add(...

Sorting by month in MS Access

I am using an MS Access db to track some tasks during the year. Each task has a due Month. I do not want to use exact dates as the convention in my team is to refer to the month. I don't want to store the dates in a date format as team members will be entering the due month by hand. Is it possible to sort my fields in date order if the ...

Query by month from date field

I have a set of Access d/b's grouped already by year. within a given year, I have a field caleld REPORTDATE which is a standard mm/dd/yyyy field. However, I need to produce queries that return data by the month. For example, I just want to see records for Jan, recs for Feb, Recs for March, etc., so that I can sum them and work wwith thm....

How would I fix the last day of the month errors that result with this php code?

Hello, The code below is what I'm using for a website menu which moves the link for the current month's page to the top of the link list on the change of the month. But this fails on the 31st of some months, such as April; I get two links to the same month for most of the links. I've read through the issues with the way php generates da...

How to calculate the number of months between two DateTimes?

Requirements: Calculate the number of months between two dates: receiveDate and dueDate. Both optimistic and pessimistic calculations are needed Assumptions: dueDate will always be the last day of the month. I've already figured out the pessimistic calculation (meaning a single day overdue counts as a whole month: if(receiveDate...

Is there a predefined enumeration for Month in the .NET library?

I'm looking to see if there is an official enumeration for months in the .net framework. It seems possible to me that there is one, because of how common the use of month is, and because there are other such enumerations in the .net framework. For instance, there is an enumeration for the days in the week, System.DayOfWeek, which inclu...

Windows Command Line Script to rename a folder to current month -3 (e.g. 2009-04 to 2009-01)

What would the Windows command line script be to rename a folder from the current month, to the current month - 3, using the format YYYY-MM ? e.g.: c:\myfiles\myFolder\ should become: c:\myfiles\2009-01\ ...

Macro to copy select rows to another worksheet and sort by month

Does anyone have a macro that will take data from a compiled list, sort out a particular month, the paste only the sorted month into a new worksheet? What I am setting up is a log where the samples are placed in the "Full List" by all employees and then when the boss wants to view only a certain months samples say January, he will be ...

MySQL Query to calculate the Previous Month

Hello I would like to calculate my total order amount in the previous month. I got the query for getting the data for the present month from the current date. SELECT SUM(goods_total) AS Total_Amount FROM orders WHERE order_placed_date >= date_sub(current_date, INTERVAL 1 MONTH); Now how can I get Previous Months Data only, excludin...

How can I print a locale aware date using Zend_Date?

I'd like to use Zend_Date to print out the previous 2 months and year as a string e.g.: July 2009 June 2009 I need it to be locale aware so that if the code runs with the locale set to, say, German, the month names will print in German. $date = new Zend_Date(); $date->subMonth(1); echo $date->get(Zend_date::MONTH_NAME).' '.$...

Zero-based month numbering

Some popular programming languages use month numbering which is off by 1 -- JavaScript comes to mind, as does Java, and if memory serves, C is another. I have some questions: If you are going to be ignoring the month numbering used by laypeople, then why not for the sake of consistency also ignore the day numbering used by laypeople, a...

How to get the number of days in a given month in Ruby, accounting for year?

I'm sure there's a good simple elegant one-liner in Ruby to give you the number of days in a given month, accounting for year, such as "February 1997". What is it? ...

jquery datepicker getMonth() weirdness

Hi all, jquery datepicker is a great fun but I am facing a weird error. I am trying to disable some days, ie. 28 October 2009 but 28 November gets disabled on the calendar! Any idea what I am doing wrong here? The disabledDays array variable is a script registered on the server as the closing dates come from database. <script type="text...

In Sharepoint, I want to trigger a workflow automatically every month which shows only the lists which has that particular months date

Hi, I am new to sharepoint... I have a question: I have a list with many documents in it. I have a date column in that list. For each month I would like to view only that particular month's list (i.e) select the list which has that month in the date field. I would like the list to get updated each month automatically according to the d...