Skip to content

Instantly share code, notes, and snippets.

@kristianfreeman
Created November 30, 2012 18:55
Show Gist options
  • Save kristianfreeman/4177732 to your computer and use it in GitHub Desktop.
Save kristianfreeman/4177732 to your computer and use it in GitHub Desktop.
require 'date'
require 'time'
dates = File.open('dates.txt')
csv_array = Array.new
dates.readlines.each_with_index do |line, i|
next if i == 0
t = Time.parse(line)
fixed_date = t.strftime("%F")
csv_array << fixed_date
end
File.open('dates.csv', 'w') {|f| f.write(csv_array) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment