dates

Dates search in Drupal (greater than, less than) using CCK / views / facelet?

I'm working in a site that manage events (like parties). Each event could have several fields, including date, that the user could add thanks to CCK module. Now, the problem is when I have to search using those fields. I could not find how to search for events between a range of dates. I discover the facelet module, which is pretty good,...

C# TimeSpan and total hours

Hi, i want to subtract two dates and get the total hours of the TimeSpan object that it's returned. For example, if the TimeSpan is of 2 days, the total hours are 48. Thanks ...

"Passing Go" in a (python) date range

Updated to remove extraneous text and ambiguity. The Rules: An employee accrues 8 hours of Paid Time Off on the day after each quarter. Quarters, specifically being: Jan 1 - Mar 31 Apr 1 - Jun 30 Jul 1 - Sep 30 Oct 1 - Dec 31 The Problem Using python, I need to define the guts of the following function: def acrued_hours_betw...

How to use Date values in charts made with gRaphael?

A little premise: I'm on a diet and I'm trying to draw a chart of my weight loss. To do that, I'm using a little django app to store the weight readings, and gRaphael (http://g.raphaeljs.com/) charting library to draw the reports. You can see the wip here: http://www.totanus.net/weight/ At this time I'm printing dates in the X-axis usi...

Select all months within given date span, including the ones with 0 values

Hi, I'm trying to write a MySQL query to get an average value per month, for all months between to given dates. My idea is this: Query, something like SELECT AVG(value1) as avg_value_1, AVG(value2) as avg_value_2, MONTH(save_date) as month, YEAR(save_date) as year FROM myTable WHERE save_date BETWEEN '2009-01-01' AND '2009-07-01' G...

MySQL/PHP that determines which week a day resides on for calendar use.

I'm trying to figure out the best way to do the following: If a user chooses a certain day, say June 21, 2010 we will repeat an event every 3rd monday of every month, but if they choose June 28, 2010 the event will repeat every last monday of every month. This is how google calendar does it, and I'm trying to repeat that functionality. ...

SSIS Import from Excel - dates in 21-Jun-10 format get inserted as NULL?

I have an SSIS import package that is bringing data into a SQL 2005 database. One of the columns has the date in the following format (dd-mmm-yy) and always gets inserted into the database as NULL. I've tried the destination column as smalldatetime, NVARCHAR, VARCHAR, and always comes in as NULL. I know if edit the column on the sheet...

Annotate a queryset with the average date difference? (django)

I searched all over place for an answer to this but couldn't find anything. Perhaps this is just a stupid question or a really tricky one. Here it is: Let's say my model is this (pseudo django code): Event type = ForeignKey(EventType) name = CharField date_start = DateField date_end = DateField EventType name = CharField W...

Using Dates in Custom post_type Permalinks in Wordpress 3.0

I'm adding a custom post_type to Wordpress, and would like the permalink structure to look like this: /%post_type%/%year%/%monthnum%/%postname%/ I can't figure out how to add the date tags. Using this code, gives me /my_type/example-post-slug/: register_post_type( 'customtype', array( ...other options... 'rewrite' => array('...

Date-based archives for custom post_types (wordpress 3.0)

If I have a custom post type named 'my_type', how can I get Wordpress to make date-based archives, for example: mysite.com/my_type/2010/ mysite.com/my_type/2010/07/ mysite.com/my_type/2010/07/28/ I'm looking for tips both on creating the rewrite rules and on linking the urls to templates. Thanks! Update: I've tried the following i...

Compare two dates in Java

Hi I need to compare two dates in java. I am using the code like this: Date questionDate = question.getStartDate(); Date today = new Date(); if(today.equals(questionDate)){ System.out.println("Both are equals"); } But this is not working. Results for both Dates are like this: questionDate returns like this: 2010-06-30 00:31...

Need help with a SQL query selecting date ranges from a table of period quarters

Hi. I have a table called Periods that looks like this PeriodID | PeriodYear | PeriodQuarter 7 | 2009 | 1 8 | 2009 | 2 9 | 2009 | 3 10 | 2009 | 4 11 | 2010 | 1 12 | 2010 | 2 Each row in the table represents 1 of the 4 quarters of the year (like 3-monthly school terms). E.g. The first row represents Period 1 of 2009 (i.e. the dat...

I have 2 dates in PHP, how can I run a foreach loop to go through all of those days?

I'm starting with 2010-05-01 and ending with 2010-05-10... how can I iterate through all of those dates? ...

java example to get all weekend dates in a given month

Hi, I need to find all the weekend dates for a given month and year, eg: 01(month), 2010(year) . the output should be :- 2,3,9,10,16,17,23,24,30,31. all weekend dates. please any idea. usman ...

Pivot a one row column T-SQL

I have a one row table returned from a query that looks something like this [Date1] [Date2] [Date3] [Date4] [Date5] [Date6] and I want all the Dates to stack up like this [Date1] [Date2] [Date3] [Date4] [Date5] [Date6] How would I go about doing this without a bunch of separate queries and union statements? I have tried playing a...

Group by month and year in MySQL

Given a table with a timestamp on each row, how would you format the query to fit into this specific json object format. I am trying to organize a json object into years / months. json to base the query off: { "2009":["August","July","September"], "2010":["January", "February", "October"] } Here is the query I have so far - SE...

Problem sorting an array of objects by date & time in Javascript - null values allowed

I'm working with an array of objects in Javascript and need to sort them by date and time. Here's the setup: place title date (optional) time (optional) Conceptually, the application allows users to create a list of places they're planning to go. The array of events is manually ordered at first, and users can optionally add date ...

C# linq dates between

Hi I am tring to get a list of dates from my db that will eventually be used to populate a calendar. Each 'calendar event' has a start date & end date, i need to get all dates between & including the start & end date. i am stuck on the WHERE statement, as i am not sure what to use for this public List<EventFeed> GetCalendarDates() ...

fastest to show x days, x hours, xminutes, x seconds

Hi there, I have two dates in mysql, I can get the difference(in seconds) by doing date1 - date2. Now I need to show x days, x hours, x minutes, x seconds If there are 0 days then it will simply be x hours, x minutes, x seconds. So, What is the best way to do this? note: 3650 seconds will show as 1 hour, 0 minutes, 50 seconds. ...

Excel automatically converts to date?

I have an excel file that always converts k 6-8 to a date. Is there anyway to not make this happen? I have tried making a plain text field to prevent this and still no luck. Any ideas? ...