I don't see a big advantage in storing it as a date, if you only want
to store the year why not store it as an integer? if then you need to
do some calculations you can always convert it to whatever you want.

On Feb 20, 11:56 pm, Scott Holland <rails-mailing-l...@andreas-s.net>
wrote:
> CiriusMex wrote:
> > Ok, so the year will just be stored as information (I mean you'll just
> > use it to display the information on a page) no?
> > If it's like that you store it as a varchar or integer I think. But if
> > you will need to process the year in other functions well it should be
> > better to store it as a year.
> > When creating a new line on your database you can use the Date.today
> > function to get the current date, after the function strftime will
> > help you to display only the year:
> > @year = <your_object>.year.strftime("%Y")
>
> > displaying @year in your html.erb page you'll only see the year from
> > the date, just as you want to.
>
> > On 20 feb, 17:32, Scott Holland <rails-mailing-l...@andreas-s.net>
>
> Thank you for the reply.
>
> I am going to use the year to calculate other things.
>
> So will it be ok to leave the the day and the month as '0' in the 'date'
> format?
>
> 2008-00-00
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to