From a16fa3d28f4686c427ab7f98b69af753ef81e133 Mon Sep 17 00:00:00 2001 From: abhilash Date: Mon, 4 Apr 2011 12:04:02 +0530 Subject: [PATCH] new version with formatted time diff output --- README | 16 ++++++++++++++++ README.rdoc | 19 +++++++++++++++++-- VERSION | 2 +- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/README b/README index d17d2c8..2cb32b9 100644 --- a/README +++ b/README @@ -16,3 +16,19 @@ You can use the difference like: diff[:year], diff[:month], diff[:week] + +Formatted Time difference +------------------------- + +%y - year +%M - month +%w - week +%d - day +%h - hour +%m - minute +%s - second + +By default the format is '%y, %M, %w, %d and %h:%m:%s' this will return '1 year, 2 months, 3 weeks, 4 days and 12:05:52'. +You will get the result from the output hash, time_diff_components[:diff] + +You can pass your own format as third parameter to this function. diff --git a/README.rdoc b/README.rdoc index 0cb42ae..05f8a14 100644 --- a/README.rdoc +++ b/README.rdoc @@ -8,13 +8,28 @@ gem install time_diff require 'time_diff' -diff = Time.diff(start_date_time, end_date_time) +time_diff_components = Time.diff(start_date_time, end_date_time) This will return the hash of time difference in terms of years, month, week, day, hour, minute and second. You can use the difference like: -diff[:year], diff[:month], diff[:week] +time_diff_components[:year], time_diff_components[:month], time_diff_components[:week] + +==Formatted Time difference + +%y - year +%M - month +%w - week +%d - day +%h - hour +%m - minute +%s - second + +By default the format is '%y, %M, %w, %d and %h:%m:%s' this will return '1 year, 2 months, 3 weeks, 4 days and 12:05:52'. +You will get the result from the output hash, time_diff_components[:diff] + +You can pass your own format as third parameter to this function. == Contributing to time_diff diff --git a/VERSION b/VERSION index 17e51c3..227cea2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.1 +2.0.0