Open woky opened 6 years ago
Hey there,
you are correct, datediff
does not provide format specifiers that result in fractional units. Your proposed work-around is probably what I'd do as well. However, essentially you'd have to hard-code details that you have no way of knowing, or, if you prefer, that dateutils have been designed to abstract away from (the number of seconds in an hour isn't always 3600).
I do agree it would be useful but I see the added complexity in specifying the exact result concisely plus I'm unsure about supporting "strange" fractions, like 6.7 weeks, or 3.22333 months.
The best way to go forward about this (and maintain backward compatibility) is using an optional qualifier something like %.H
. Precision could be hard-limited to 3 (full minutes) or 5 (resolution to the second) digits but it's just a matter of time until someone requests full precision control. Ah well.
I couldn't figure out from the documentation how to get floating point result from
datediff
. I'd like to get decimal duration in hours (?
stands for modifier I'd like to use but am not aware of):Currently I can only get duration in hours truncated to integer:
Of course this is possible:
But that's a little bit verbose and output is too... scientific. I realize that this would pull in complexity of floating point formatting so please disregard if out of scope. And if this is already possible, then please point me to the relevant section of manual, close this issue, and accept my apology for not reading the manual properly.