On Saturday, January 26, 2013 8:50:13 AM UTC-8, Adam Gotterer wrote:
> How can I find the difference between two times and extract the hours
> between them? I was able to do it with a literal, but I was wondering if
> there was a better way.
>
> select('date1 - date2'.lit.extract(:hour))
>
You can currently do:
Sequel.extract(:hour, :date1 - :date2)
By default, the following does not work:
(:date1 - :date2).extract(:hour)
But you can make it work by doing:
Sequel::SQL::NumericExpression.send(:include,
Sequel::SQL::ComplexExpressionMethods)
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.