Im currently porting some c++ code to ruby, i'm returning a date value from zabbix which comes back as a date primitive.
The current code for doing this is:
Math.round(((new Date().valueOf()) - parseInt(result[0].value) * 1000) / 86400000)
I got this so far:
(result[0]['value'].to_i*1000) / 86400000).round
Not sure how to port new Date().valueOf()
1441972284808
looks like Unix Timestamp in milliseconds, so you can try this:
time = Time.at(1441972284808 / 1000.0)
# => 2015-09-11 16:51:24 +0500
time.strftime('%j') # days quantity from start of the year
# => "254"