Created
February 1, 2015 19:12
-
-
Save donat-b/ff7b35ac530c4e8a4ed6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Generates list of dates according to a format passed as an argument | |
# Example: date-listgen.rb '%Y-%m-%d' | |
# 2015-02-01 | |
require 'date' | |
def list_dates(format) | |
if format.nil? | |
format = '%d%m%Y' | |
end | |
d = Date.new(1900,1,1) | |
today = Date.today | |
begin | |
d = d + 1 | |
puts d.strftime(format) | |
end until d == today | |
end | |
list_dates(ARGV[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment