[Stamp Gem(Stamp Gem)]
Stamp gem is the best gem for converting format of Dates and Times in Human friendly formats.
Its very easy to use in our rails application.
We can use this gem as:
gem install stamp
or inlude this line in gem file
Suppose, I have a date = 2014-01-15 18:19:07 +0530
then we can convert this date into humans friendly date format like
date.stamp('1-Jan-2000') => '15-Jan-2014' date.stamp('1st Jan') => '15th Jan' date.stamp('Jan 1, 2000') => 'Jan 15, 2014' date.stamp('Jan 01') => 'Jan 15' date.stamp('01-Jan-2000, 00:00') => '15-Jan-2014, 18:19' date.stamp('01-Jan-2000, 00:00 AM') => '15-Jan-2014, 18:19 PM'
Subscribe to Engineering At Kiprosh
Get the latest posts delivered right to your inbox