Reputation: 10035
I'm currently doing:
DateTime::strptime('12/11/17', "%d/%m/%Y")
=> Fri, 12 Nov 0017 00:00:00 +0000
But I want Mon, 11 Dec 2017 00:00:00 UTC +00:00
Thanks in advance
Upvotes: 0
Views: 56
Reputation: 161
The following snipped should do what you are looking for (using ruby 2.3):
DateTime::strptime('12/11/17', "%m/%d/%y").strftime("%a, %d %b %Y %H:%M:%S UTC %Z")
#=> "Mon, 11 Dec 2017 00:00:00 UTC +00:00"
Upvotes: 2