relative-date

What's the best way to produce a relative date range (This week, This year, Last month, etc) from a DateTime?

I'm sure I'm not the first person to need to do this, so I'm looking for the best way. I've got a set of radio buttons with choices such as This Year Last Year This Month Last Month This Week Last Week and I need to produce the proper relative date range from the current date (DateTime.Now). For example if Last Year was selected a...

How can I create relative/approximate dates in Perl?

I'd like to know if there are any libraries (preferably DateTime-esque) that can take a normal date time and create an appropriate relative human readable date. Essentially the exact opposite of the more common question: How can I parse relative dates with Perl?. Obviously, the exact wording/interpretation is up to the actual implementa...

Java: date & time relative to current (server) time

We're using MySQL to store some dates. I'm looking to show these as relative time periods in the user interface: 2 hours ago, 3 days ago etc. (Like Twitter does for the updates for example) Is there a well-known way to accomplish this, or should I get creative with it? Just to be clear, I want to transform: 07/26/2009 12:20 -> '2 days ...

How to implement the "Member for " interval like SO in PHP?

Possible Duplicate: How do I calculate relative time? It shows 2 days,2 month,1 year and so on. How to do it? ...

Can I parse relative times with JodaTime?

I'd love to be able to parse relative strings like now and yesterday and get JodaTime DateTimes. Is it possible? DateTimeFormat.forPattern and doesn't seem to support English relative times and I don't know of any other parsing options in JodaTime. I should add that I'm using scala-time but can easily drop down to the actual JodaTime cl...

PHP: producing relative date/time from timestamps

Hi, I'm basically trying to convert a Unix timestamp (the time() function) to a relative date/time that's both compatible with past and future date. So outputs could be: 2 weeks ago 1 hour and 60 minutes ago 15 minutes and 54 seconds ago after 10 minutes and 15 seconds First I tried to code this, but made a huge unm...

Relative time function in js for format YYYY-MM-DDTHH:MM:SS+0000

Hey, I was wondering if anyone knew how I could parse this type of date format: 2010-07-26T18:02:46+0000 into the relative time such as "30 seconds ago" I already have a function which does it for a similar but different time format: function relative_time(time_value, is_relative) { var values = time_value.split(" "), ...

R heights graph - relative to birth date

I have a group of people, with a space-separated text file for each person. In these files, the right value indicates the height of that person in cm and the left value indicates the date in %d/%m/%Y format: 09/05/1992 0 17/03/1993 50 02/08/1994 65.5 03/12/1995 72 A height of 0 marks the birth date of the person. This R script draws ...