Reputation: 544
Time returned from salesforce is in this format 2017-07-14T12:02:23.000+0000
But I want to convert my saved time that is updated_At Wed, 04 Oct 2017 23:00:45 PDT -07:00
I tries to convert it in utc with time_var.utc but it returned 2017-10-05 06:00:45 UTC
How can i get the time in salesforce Format 2017-07-14T12:02:23.000+0000
Upvotes: 1
Views: 217
Reputation: 180
time_in_utc = DateTime.parse product.updated_at.utc.to_s
last_update_time = time_in_utc.iso8601
Upvotes: 2
Reputation: 2675
updated_at = "Wed, 04 Oct 2017 23:00:45:032 PDT -07:00"
Time.parse(updated_at).utc.strftime("%Y-%m-%dT%T.%L%z")
Upvotes: 1