datemath

How do I do date math in a bash script on OS X Leopard?

I realize I could whip up a little C or Ruby program to do this, but I want my script to have as few dependencies as possible. Given that caveat, how does one do date math in a bash script on OS X? I've seen a post (on another site) where someone did the following: date -d "-1 day" But this does not seem to work on OS X. Addendum: S...

Date Math in Reporting Services Expression

I'm trying to add days to a date and then compare to see if it's outside a range to color code a cell. It's not working--I think I may be making a simple syntax error. iif( (DateAdd("d", CInt(Fields!Days.Value), Fields!Date.Value) < Now), "Red", "White") ) ...

Comparing dates in rails

Suppose I have a standard Post.first.created_at datetime. Can I compare that directly with a datetime in the format "2009-06-03 16:57:45.608000 -04:00" by doing something like: Post.first.created_at > Time.parse("2009-06-03 16:57:45.608000 -04:00") Edit: Both fields are datetimes, not dates. ...

DATE_ADD functionality in Ingres

Many (most? nearly all?) SQL dialects have a way to perform this type of function: date_add( MyDate, MyInterval ) I've been through all of the docs, but I cannot find this functionality in Ingres. My immediate goal is to get "MyDate plus 3 months". Does anyone know if there is a simple way to do this that I'm missing? Note: I realize t...

Remove Expired Records in solr query syntax

Hi, I'm having a solr query syntax issue (I think) with solr 1.4. I'm trying exclude expired records from a solr query. However if the record doesn't have an expiry record, i would like to bring that record back also. E.g. To only get a list of record that haven't expired i am using this query: expirydate:[NOW/DAY TO *] Then I thoug...

Best way to find the months between two dates (in python)

I have the need to be able to accurately find the months between two dates in python. I have a solution that works but its not very good (as in elegant) or fast. dateRange = [datetime.strptime(dateRanges[0], "%Y-%m-%d"), datetime.strptime(dateRanges[1], "%Y-%m-%d")] months = [] tmpTime = dateRange[0] oneWeek = timedelta(weeks=1) tmpT...