dates

Handling partial/incomplete dates in .NET

I have the need to handle partial dates, so for example: 1 April 2009 (stored as 1, 4, 200) Jan 2000 (Stored as null, 1, 2000) March 90 (Stored as null, 3, 1990) 00 (Stored as null, null, 2000) and so on. Looking at it, I don't think it's a massive problem as it will only have to handle UK dates, so globalization is not a considerat...

How can I calculate how many nights are there in a date range?

I need to calculate the quantity of nights (stay at a hotel) from the checkin and checkout dates. What is the best way to do it? ie: If I have Checkin: 12/11/2009 15:00 hs Checkout: 14/11/2009 12:00 hs Doing (Checkout - Checkin).Days would give me 1 night instead of 2 I'm thinking of adding a simple if to check the hours (if ch...

Odd behavior of mktime()

Continuing on my attempt to create a DateTime class , I am trying to store the "epoch" time in my function: void DateTime::processComponents(int month, int day, int year, int hour, int minute, int second) { struct tm time; time.tm_hour = hour; time.tm_min = minute; time.tm_sec = second; ...

SQL Server Date Formats -- ddd

How do I get the day of the week (in ddd format, so Mon, Tue etc.) in SQL ? I don't see anything about it in the CAST and CONVERT documentation.. ...

sqlite writing a date into an email

Hi, I am exporting a date value from sqlite and placing it into an email. The date appears like this 279498721.322872 I am using Objective C in an Iphone App. Does anyone know how to make this export out as a regular date whether it is all number like 2009-02-10 or anything legible? ...

drupal, rules, flag, date

Hi, Hope someone can advise. I am using drupal 6. I have a node called [classroom]. I would like to have a [vacancy register] associated with each classroom. vacancy register is a cck type with: - uid - nid - join date I would like for each user to [register] for a vacancy. I think I can use flag for this. When a user joins, I ca...

How to handle recurring dates (dates only) in .NET?

I am trying to figure out a good way to handle recurring events in .NET, specifically for an ASP.NET MVC application. The idea is that a user can create an event and specify that the event can occur repeatedly after a specific interval (e.g. "every two weeks", "once a month" and so on). What would be the best way to tackle this? My br...

check on overlapping dates (vb.net)

Hi in a program I'm writing I'm creating some objects with a start date (with a datepicker) and an end date (also with a datepicker). Now I need to check if this object's date range overlaps with any other object's date range stored in the database. If it does I can't save it in the database but if it doesn't I can. Anyone has an idea...

Date Extraction Libraries

Does anyone know if there are any libraries around that will extract dates and times given a body of text? It doesn't matter which language, I'm just looking for a library to play with. ...

How do you set a date in a mysql update from a milliseconds since epoch value?

I want to fill out some null dates with default dates, which should be the epoch date. eg set updateDate = somethingtoconvertEpochDateToDateTime(numberofMillisSinceEpoch) ...

Build date range...

I have a start date of 20090101 and an end date of 20091130 and I'm trying to build and array of all the months in between, which would look like this: <?php /* ... */ $arrDates['Jan'] = 2009; $arrDates['Feb'] = 2009; $arrDates['Mar'] = 2009; /* ... */ ?> How can I do this? ...

How to group items by date range in XSLT?

I have a bunch of data that looks a little like this: <item> <colour>Red</colour> <date_created>2009-10-10 12:01:55</date_created> <date_sold>2009-10-20 22:32:12</date_sold> </item> <item> <colour>Blue</colour> <date_created>2009-11-01 13:21:00</date_created> <date_sold>2009-11-21 12:32:12</date_sold> </item> <item> <colou...

Array of Dates in Java

I know how to create an array of strings or integers, but how does one create an array of dates :/ ...

Returning the Quarter in SQL Server

I am a complete novice at SQL Server and naively thought that there would be a QUARTER() function, alas there is not and some googling didn't come up with anything useful! Basically what I want to achieve is that for all rows in my database I want a count of those rows grouped by Quarter. If possible I would like to keep all calculatio...

How do I exclude Weekend days in a SQL Server query?

How do I exclude values in a DateTime column that are Saturdays or Sundays? For example, given the following data: date_created '2009-11-26 09:00:00' -- Thursday '2009-11-27 09:00:00' -- Friday '2009-11-28 09:00:00' -- Saturday '2009-11-29 09:00:00' -- Sunday '2009-11-30 09:00:00' -- Monday this is the result I'm looking for: d...

How can I store and query schedule data?

I'd like to allow my users to setup a schedule for their events. It could be a single day, or for convenience I'd like to allow them to specify a reoccurring event (similar to an Outlook appointment). For the single event it seems pretty easy (pseudo-code): Just have a DateOfEvent column that has the date on it. To grab future events:...

End date must be after start date (jquery for noobs)

I'm having a heck of a time wrapping my head around JQuery syntax (probably because my javascript isn't that solid to begin with). Here's my problem. I'm using datepicker on two input boxes (#ev_start and #ev_end) #ev_end must occur after #ev_start. HTML Event Start <input type='text' name='ev_start' id='ev_start'/> Event End <inpu...

Is there a reliable way to convert unzoned datetime into UNIX time_t?

I need to convert a database column in a (MSSQL) database table into UNIX time_t. The problem is that this column does not have a timezone and some dates are from GMT (+0000) and some from BST (+0100). I am working on UK times. Is there a reliable way to convert unzoned datetime into UNIX time_t? I'm currently using SELECT *,DATEDIFF(s...

Formatting a date in my titleForHeaderInSection

Hello, I am working on a simple to do list application, and I am wanting to set the date in a normal format in the titleForHeaderInSection part of my uiTableView. But I am having some issues. It works to an extent, but is giving me way too much information, it shows: 2009-12-01 00:04:10 -0700 in the field where I'd just like it to sho...

NSDateFormatter: I Don't want the time!

I am playing around with the coredatabooks source code example from the apple website, or here. I am trying to set the books copyright date attribute value to replace the author as the tableview section header, and I need the date value to be static, meaning I don't need the time, otherwise all of the date values are different, and no tw...