I have this piece of code: Time.now.beginning_of_day.to_s(:db) What exactly does the (:db) do? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It''s an argument to the to_s method of the Time class that changes the date format. It''s part of the Rails extensions to the core ruby classes. Here are a couple of other format options: Time.now.to_s(:short) Time.now.to_s(:long) My guess is that the :db format is used for storing dates in the database. For more info take a look here: http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Conversions.html Aaron On Mar 14, 5:26 pm, "jko170" <jko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have this piece of code: > Time.now.beginning_of_day.to_s(:db) > What exactly does the (:db) do?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Got it, thanks! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You might be interested in checking out Day 35 of the Rails Rubyisms Advent calendar [it only sounds ridiculous] which talks a little more about it. There''s a link there that used to go into quite a bit of depth about it but it seems not to be active right now. At any rate, you''ll probably learn a heck of a lot from that calendar anyhow. I know I did. RSL On 3/15/07, Aaron <baldwina-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > It''s an argument to the to_s method of the Time class that changes the > date format. It''s part of the Rails extensions to the core ruby > classes. Here are a couple of other format options: > > Time.now.to_s(:short) > Time.now.to_s(:long) > > My guess is that the :db format is used for storing dates in the > database. > > For more info take a look here: > > http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Conversions.html > > Aaron > > On Mar 14, 5:26 pm, "jko170" <jko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have this piece of code: > > Time.now.beginning_of_day.to_s(:db) > > What exactly does the (:db) do? > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 15, 11:54 am, "Russell Norris" <sco...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You might be interested in checking out Day 35 of the Rails Rubyisms Advent > calendar [it only sounds ridiculous] which talks a little more about it. > There''s a link there that used to go into quite a bit of depth about it but > it seems not to be active right now. At any rate, you''ll probably learn a > heck of a lot from that calendar anyhow. I know I did.Wow, thanks for the tip. Real nice :-)> > RSL > > On 3/15/07, Aaron <baldw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > It''s an argument to the to_s method of the Time class that changes the > > date format. It''s part of the Rails extensions to the core ruby > > classes. Here are a couple of other format options: > > > Time.now.to_s(:short) > > Time.now.to_s(:long) > > > My guess is that the :db format is used for storing dates in the > > database. > > > For more info take a look here: > > >http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/... > > > Aaron > > > On Mar 14, 5:26 pm, "jko170" <jko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have this piece of code: > > > Time.now.beginning_of_day.to_s(:db) > > > What exactly does the (:db) do?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---