demo/my_functions.rb
# Calculate execution date in the format yyyy-mm-dd
Calculate execution date in the format yyyy-mm-dd
Calculate execution date in the format yyyy - mm - dd
def calculate_exec_date( actual_time, user_value )
      uv = user_value.nil? ? 0 : user_value 
      pos = uv.to_s =~ /^[+-]?[0-9]+$/
      if pos == 0 
        return shift_date(actual_time, uv.to_i).strftime("%F")
      end
      uv = nil if user_value == "empty"
      uv 
    end
def calculate_exec_date ( actual_time , user_value ) uv = user_value . nil? ? 0 : user_value pos = uv . to_s =~ / ^[+-]?[0-9]+$ / if pos == 0 return shift_date ( actual_time , uv . to_i ) . strftime ( "%F" ) end uv = nil if user_value == "empty" uv end
Calculate execution date in the format yyyy-mm-dd
Calculate execution date in the format yyyy - mm - dd
# set default value if none specified # this is a valid delta in number of days # this is the value if it's no delta
actual_time
<not_specific>
user_value
<not_specific>