Skip to content

Instantly share code, notes, and snippets.

@StephenOTT
Last active December 21, 2015 05:08
Show Gist options
  • Save StephenOTT/6254185 to your computer and use it in GitHub Desktop.
Save StephenOTT/6254185 to your computer and use it in GitHub Desktop.
Sample of code for converting date/times to a proper format for import into Mongodb
issues.each do |y|
y["created_at"] = DateTime.strptime(y["created_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
y["updated_at"] = DateTime.strptime(y["updated_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
if y["closed_at"] != nil
y["closed_at"] = DateTime.strptime(y["closed_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment