dates

Count weekends between 2 dates

I'm writing a price calculator where weekends have a special price. To do this I need to know how many weekends there are between 2 dates. Note that by a weekend, I mean if they want to have thursday to tuesday, the saturday and the Sunday are not 2 days with a weekend rate, but 1 weekend with a single rate. Thus for Thursday -> Tuesday...

Business date/holiday handling

I've posted this question for C# but I may be working in Ruby instead. So I'm asking the same question about Ruby: I'm looking for a Ruby class/library/module that works similarly to the Perl module Date::Manip as far as business/holiday dates. Using that module in Perl, I can pass it a date and find out whether it's a business day (i...

How do I get the current date in ISO format using Perl?

What's the most efficient way to get the current date in ISO format (e.g. "2010-10-06") using Perl? ...

Adding minutes to datetime on insert - mysql

I've tried this INSERT INTO products (product_id, product_type, created_dt, end_dt) VALUES ('11', '1', '2010-10-08 00:11:10', DATE_SUB(2010-10-08 00:11:10, INTERVAL 59 Minute)) But this doesn't work. Any other ways to do this within Mysql? Thanks! ...

t-sql get all dates between 2 dates

Possible Duplicate: Getting Dates between a range of dates Let's say I have 2 dates (date part only, no time) and I want to get all dates between these 2 dates inclusive and insert them in a table. Is there an easy way to do it with a SQL statement (i.e without looping)? Ex: Date1: 2010-12-01 Date2: 2010-12-04 Table should h...

Format javascript date to match rails format

I get a date back from rails that looks like: "2010-10-29T00:00:00+00:00" And I'd like to convert a javascript date created by 'new Date()' to that format. Is there an easy way? ...

Dealing with periods and dates without using cursors

I would like to solve this issue avoiding to use cursors (FETCH). Here comes the problem... 1st Table/quantity ------------------ periodid periodstart periodend quantity 1 2010/10/01 2010/10/15 5 2st Table/sold items ----------------------- periodid periodstart periodend solditems 14343 2010/10/05 2010/10/06 2 Now...

Human Readable Date Using PHP

Hello. Please help me create a function to convert dates like 2010-10-04 17:45:50 Into something more pretty like 10 October at 17:45 And so it can hide years if they are not really needed and display date like today/yesterday at 17:45 This is a bit similar to how Facebook displays past dates. ...

Optimal way to store in MySQL available dates in multiple years

We are developing a MySQL database (with frontend and backend) with holiday packages. We have everything figured out except for the best method to store the departure dates of the tour packages. Some packages are available almost every day of the year; others are only available on tuesdays and wednesdays; others leave every monday betwe...

Javascript Date objects and Daylight Savings Time

I'm seeing some behavior I don't understand with Javascript date objects and DST transitions. If I execute the following in Chrome's javascript console var date = new Date(1268535600000); //2010-03-14T03:00:00.000Z (21:00 03-13 America/Chicago) for(var i = 1; i <= 12; i++) { var time = date.getHours(); console.log(time) ...

Calculate number of business days between two days

I need to calculate the number of business days between two dates. How can I pull that off using Ruby (or Rails...if there are Rails-specific helpers). Likewise, I'd like to be able to add business days to a given date. So if a date fell on a Thursday and I added 3 business days, it would return the next Tuesday. ...

How do I parse timezones from dates in python

Here's what I have tried so far. I'm just not too sure as to why it outputs as PST instead of GMT. I'm not sure if that's not the correct way to parse it, or to output it. Something seems to be wrong somewhere. >>> x = time.strptime('Wed, 27 Oct 2010 22:17:00 GMT', '%a, %d %b %Y %H:%M:%S %Z') >>> time.strftime('%a, %d %b %Y %H:%M:%S %Z...

C#: Get all week numbers from within 2 dates globalized/ISO 8601 compatible

I have a startdate 2010-01-01 (I just assume its a first day of the week) and an enddate 2010-07-31 (I just assume its a first day of the week) I want to have returned from a method all week numbers for every first day of the week for the above timespan. I can not assume that the first day of week is always monday, because my user...