class Time

Public Instance Methods

to_df(type = nil) click to toggle source

Format a time object to a Discord formatted string.

@param [“f”, “F”, “d”, “D”, “t”, “T”, “R”] type The format to use.

@return [String] The formatted time.

# File lib/discorb/extend.rb, line 11
def to_df(type = nil)
  if type.nil?
    "<t:#{to_i}>"
  else
    "<t:#{to_i}:#{type}>"
  end
end