Time.parse () should allow you to analyze the time of the entire date. Then you can use time.strftime (string) to format it as a date in a string.
date = Time.parse ("2011-06-02T23: 59: 59 + 05: 30")
date_string = time.strftime ("% y-% m-% d")
of
date_string = time.strftime ("% F")
(see Ruby Doc for Time for more output string formats) The above should work if you want a string; if you want a date object to be processed, the Ruby Date class can help you deal with this, but I believe that you still need to do with Time objects; see Ruby Doc for Date for details on the Date class.
Hope this helps, let me know if I answer in the wrong direction with my answer.
Taft
source share