module Eddy::Util::Time

Functions for formatting [Time](ruby-doc.org/stdlib-2.6.5/libdoc/time/rdoc/Time.html) objects.

Public Class Methods

ccyymmdd(date = Time.now.utc) click to toggle source

Generates an timestamp in `CCYYMMDD` format.

@param date [Time] A UTC formatted `Time` object. @return [String]

# File lib/eddy/util/time.rb, line 12
def self.ccyymmdd(date = Time.now.utc)
  return date.strftime("%Y%m%d")
end
hhmm(time = Time.now.utc) click to toggle source

@param time [Time] A UTC formatted `Time` object. @return [String]

# File lib/eddy/util/time.rb, line 30
def self.hhmm(time = Time.now.utc)
  return time.strftime("%H%M")
end
hhmmss(time = Time.now.utc) click to toggle source

@param time [Time] A UTC formatted `Time` object. @return [String]

# File lib/eddy/util/time.rb, line 36
def self.hhmmss(time = Time.now.utc)
  return time.strftime("%H%M%S")
end
hhmmssd(time = Time.now.utc) click to toggle source

@param time [Time] A UTC formatted `Time` object. @return [String]

# File lib/eddy/util/time.rb, line 42
def self.hhmmssd(time = Time.now.utc)
  return time.strftime("%H%M%S%1N")
end
hhmmssdd(time = Time.now.utc) click to toggle source

@param time [Time] A UTC formatted `Time` object. @return [String]

# File lib/eddy/util/time.rb, line 48
def self.hhmmssdd(time = Time.now.utc)
  return time.strftime("%H%M%S%2N")
end
yymmdd(date = Time.now.utc) click to toggle source

Generates an timestamp in `YYMMDD` format.

@param date [Time] A UTC formatted `Time` object. @return [String]

# File lib/eddy/util/time.rb, line 20
def self.yymmdd(date = Time.now.utc)
  return date.strftime("%y%m%d")
end