I am running into a uninitialized constant Context::DateTime error in Ruby. My code is:
# Print data about a list of Tweets
def print_timeline(tweets)
tweets.each do |tweet|
d = datetime.new(tweet['created_at'])
puts "#{tweet['user']['name']} , #{tweet['text']} , #{d.strftime('%m.%d.%y')} , #{tweet['id']}"
end
end
I believe it is saying it cannot find the DateTime class, and I am not sure why. I am new to Ruby.
DateTime should be capitalized, just like in the title of your question. Also you may have to add a:
require "date"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With