On 2 Mar 2009, at 10:28am, Peter Vandenabeele wrote:

>
> On Mon, Mar 2, 2009 at 10:50 AM, Ian Piper <[email protected]> wrote:
>> I am not sure
>> how best to manage the time measurements (DateTime or Time?) or how  
>> to
>> build the business rules to do the measurements and comparisons
>> robustly.
>>
>> I wondered whether anyone here could direct me to an example.
>
> If you don't need increments smaller than 1 day, I prefer to use the  
> Date class.
> I find it easier than Time to work with:
> * no ambiguity over "now" being a different date in different time  
> zones etc
> * easier to compare date_1 == date_2
>
>  http://ruby-doc.org/stdlib/libdoc/date/rdoc/classes/Date.html

Thanks Peter,

Those are good examples. You mention using Date for increments that  
are not smaller than one day. In fact my situation is a hybrid, since  
the machinery may be running at intervals over several days (so I  
would need to track a usage event that spans days) but I need to  
record the total number of hours of use during that time. From what I  
can see the DateTime class allows for this. I suppose what I am really  
asking here is under what circumstances would I use the Time class:  
using DateTime always gives me more information doesn't it?


Ian.
--

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to