Skip to main content
1 of 2
sepp2k
  • 1.9k
  • 1
  • 18
  • 16

Ruby, 93 characters

require"date"
$><<(Date.parse($*[0]||Date.today.to_s)+1..1.0/0).find{|d|d.wday==5&&d.day==13}

Ungolfed:

require "date"
$stdout << (Date.parse(ARGV[0]||Date.today.to_s)+1..Float::INFINITY).find do |d|
  d.wday == 5 && d.day == 13
end

Sample IO:

$ ruby fr13th.rb 2013-05-09
2013-09-13
$ ruby fr13th.rb 2007-06-29
2007-07-13
$ ruby fr13th.rb 2007-07-13
2008-06-13
$ ruby fr13th.rb
2011-05-13
sepp2k
  • 1.9k
  • 1
  • 18
  • 16