Closed ajmyers01 closed 8 years ago
I'm trying to get all time entries for a ticket within the last year.
Is there a specific Condition for comparing dates ?
query = AutotaskAPI::QueryXML.new do |query| query.entity = 'timeentry' end year_ago = (DateTime.now - 1.year).to_formatted_s(:iso8601) query.add_condition('ticketid', 'equals', ticket_id) query.add_condition('type', 'equals', 2) query.add_condition('dateworked', 'GreaterThan', year_ago) @client.query = query
I've successfully used something like:
@query.add_condition 'CreateDate', 'GreaterThan', 3.months.ago.to_s
It might be a matter of simply calling .to_s on your date.
.to_s
I'm trying to get all time entries for a ticket within the last year.
Is there a specific Condition for comparing dates ?