I am creating the params for an API URL Param Query, and I require a variable that represents 24 hours in the past. Which I have stored below.
def date_time
now = DateTime.now
@past_time = (Time.new - 1.days).to_s(:db)
end
Output => "2021-11-28 18:39:02"
I then use this URL in my API, but when printing out the URL I see that a '20' has appeared before the hour portion of Time. I can't figure out what and why causes this change, any ideas?
Output with problem digits bolded:
def url_param_creator
url = URI("#{Settings.zendesk.url}/search.json?query=type:ticket status:closed updated<#{@past_time}")
puts url
end
=> https://******.zendesk.com/api/v2/search.json?query=type:ticket%20status:closed%20updated%3CMon,%2029%20Nov%202021%2017:20:03>