The Artima Developer Community
Sponsored Link

Java Buzz Forum
20.weeks.ago vs. java.util.Calendar

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
20.weeks.ago vs. java.util.Calendar Posted: Dec 5, 2005 9:56 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: 20.weeks.ago vs. java.util.Calendar
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement

After playing with a Rails project that needed to do a lot of date maniupulation, I was shown another of the many "small" differences that make you so glad you are in Ruby-land.

With Ruby, and the time extensions that Rails adds to the Ruby time module, you get to do things like:

20.minutes.ago
20.hours.from_now

now = Time.now
now.at_beginning_of_year
now.midnight
now.last_month
now.monday
now.next_year
now.tomorrow
now.yesterday
now.seconds_since_midnight

This is just a touch of what you can do.

The thought of doing a lot of this work in Java with the great java.util.Calendar and java.util.Date makes me cringe. I have a DateUtil that I use to do a lot of work, and there are other utils like JodaTime etc, but none compare in my opinion.

Read: 20.weeks.ago vs. java.util.Calendar

Topic: Would You Like Intermission Ads? Previous Topic   Next Topic Topic: 11-24-2005 042 [Flickr]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use