Ruby: how do I calculate a duration given 2 datetimes from a CSV file? -
I have many CSV files, including initial and end time. I use fast CSVV to parse files I can, but I do not know the best way to get this period in Ruby. Values are given in my hash for each line of CSV files.
Start time: Mon Jul 20 18:25:17 -0400 2009 Expiry time: Mon 20 July 18:49: 43 -0400 2009 < Div class = "post-text" itemprop = "text">
You can find a duration to reduce the datetime from the second. If you are included in it, then you will find Destime objects for long as Fasters CSG: date_time converter for example:
Fasters C Veerach (Some_file ,: converters = & gt; [: date_time]). Line | #blah end
Or, you can only change yourself using Datetime # Parse.
From there, you can use to get an array containing [hours], minutes, seconds, fraction_of_a_second]
, which I think only part of the day It's easy to work with.
Depending on what you want them to display, there is probably information that will help you in those north rails, but you can always include the necessary parts from the rail, or only the tasks (Available in Rail Documentation) can see how they do it. It is quite self explanatory.
Comments
Post a Comment