Sha256: 1ad4e115cb66a82075bdea2b53c2535cb5a19186d93d3dcf62b4ba566461322f

Contents?: true

Size: 680 Bytes

Versions: 4

Compression:

Stored size: 680 Bytes

Contents

# -*- coding: utf-8 -*-
=begin rdoc
Please see README
=end

class Time

  # Create a time stamp string using the format "YYYY-MM-DDTHH:MM:SSZ"
  #
  # This standard format is specified in IETF RFC 3339 and ISO 8601.
  #
  # @see http://www.ietf.org/rfc/rfc3339.txt
  #
  # Example:
  #
  #     time = Time.now
  #     time.stamp 
  #     => "2010-12-31 12:59:59Z"
  #
  # Return: [String] a time stamp string
  #
  def stamp
    getutc.strftime('%Y-%m-%dT%H:%M:%SZ')
  end

  # Shorthand for Time.now.stamp
  #
  # Example:
  #
  #     Time.stamp
  #     => "2010-12-31T12:59:59Z" 
  #
  # Return: [String] Time.now time stamp string
  #
  def self.stamp
    now.stamp
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sixarm_ruby_time_stamp-2.0.0 lib/sixarm_ruby_time_stamp/time.rb
sixarm_ruby_time_stamp-1.1.6 lib/sixarm_ruby_time_stamp/time.rb
sixarm_ruby_time_stamp-1.1.5 lib/sixarm_ruby_time_stamp/time.rb
sixarm_ruby_time_stamp-1.1.4 lib/sixarm_ruby_time_stamp/time.rb