# Another Date Class

**URL:** <https://www.ruby-forum.com/t/another-date-class/147299>\
**Category:** Ruby\
**Created:** [August 30, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/another-date-class/147299 "2008-08-30T16:44:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damiennn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@damiennn](https://www.ruby-forum.com/u/damiennn)\
**Post date:** [August 30, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/another-date-class/147299/1 "2008-08-30T16:44:26Z")

</div>

hi,

I need to develop new date class in ruby rather then built in date class  
program needs to do these things below

1. Read a series of dates from an ASCII text file. You can assume that  
all dates in the file are in an acceptable format, with the elements in  
the order day, month and year, with the separator being any non-numeric  
character. A suitable input file is provided on the course web site.
2. If a date is in error, use exceptions to handle the error and  
discard any erroneous dates. Any error messages should be displayed to  
the console.
3. Sort the valid dates read from the text file into ascending order.
4. Dates should be able to be displayed in two formats â€“ either  
17/07/2008 or 17th July 2008.
5. Implement an increment method that increments the date by a day

Test Data  
21/07/2008  
22 07 2008  
23:07:2008  
1/1/2001  
29/2/2004  
29/2/2003  
-2/13/2008

I’m new in ruby just need some help at least for a start.

---

<div class="post-metadata">

**Author:** ![damiennn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@damiennn](https://www.ruby-forum.com/u/damiennn)\
**Post date:** [August 30, 2008, 5:18pm UTC](https://www.ruby-forum.com/t/another-date-class/147299/2 "2008-08-30T17:18:05Z")

</div>

Hmmm Hmmm wrote:

> 1. Sort the valid dates read from the text file into ascending order.
> 2. Dates should be able to be displayed in two formats â€“ either  
> 17/07/2008 or 17th July 2008.
> 3. Implement an increment method that increments the date by a day

This looks an awful lot like homework.

---

<div class="post-metadata">

**Author:** ![damiennn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@damiennn](https://www.ruby-forum.com/u/damiennn)\
**Post date:** [August 30, 2008, 7:31pm UTC](https://www.ruby-forum.com/t/another-date-class/147299/3 "2008-08-30T19:31:29Z")

</div>

Bill W. wrote:

> Hmmm Hmmm wrote:
> 
> > I need to develop new date class in ruby rather then built in date class  
> > program needs to do these things below

> This looks an awful lot like homework.

Yes. Somebody going by the name “Michael C.” posted the same question  
two days ago. It’s a pity that “Michael” and “Hmmmm” can’t work on a  
solution together.

It truly is Eternal September. I wonder if the instructor is clueful  
enough to read ruby-talk?
